Preparing for Free Code Camp Bonfires

2 min read

\"Tears\"

I am almost ready to get to the Free Code Camp Bonfires. I am still working through the new curriculum with the extra JavaScript waypoints but because I have been working in Java at school and reading Data Structures and Algorithms with JavaScript by Michael McMillan and things are becoming increasingly clear to me.

I also created and watched this YouTube playlist and a lot of the methods we used in the Bonfires and now I am really excited to tackle the algorithms.

I have practiced using some of the methods in a blog post on another blog. Here is one of using the map method:

var even = [2,4,6,8];

var odd = even.map(function(num) {
   return num + 1;
});
odd;

I am starting to grasp passing parameters in a function and how that relates to arguments and the difference between the two.

A parameter is a variable in the declaration of a function. The value of that variable is the argument you pass into the function when it is called.

Still Learning

I have assignment 2 to worry about so I won’t be going to Free Code Camp for a while. Signed up for HackerRank but haven’t been able to get to it. I was in a serious depressive state for a while with little energy, panic attacks, the whole nine yards. Needless to say, I didn’t blog or get much work done otherwise. So I have to grind out some code for class and it is actually helping me with JavaScript and it’s new OOP features, believe it or not.

Thoughts

I have a long way to go still and it is getting frustrating. I am learning more and more every day, however, and so I know I am improving. I have been at this seriously for a little under a year. I am a complete newbie. I’ll get better with time.

CC BY-SA 4.0 Preparing for Free Code Camp Bonfires by Tiffany White is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

  • Map, filter and reduce are really handy methods for transforming lists. I haven’t used them in javascript but your code above looks more like a filter than a map.

    • twhite6878

      I was trying to use map in a filter-like way. Unfortunately I don’t think my idea panned out, as in the console, when I called odd, it would give me [false, false, false, false]; which isn’t what I wanted. So I will change it.

      • Cool

        Map creates a new list from an old list. Each item in the new list is the result of transforming the corresponding item from the old list with the function passed in.

        Filter will evaluate a function with each item from a list and remove items if they evaluate to false.

        In this case, map made a new list where each item was evaluated to _false_ or even.

        Filter will give you the results that you are expecting, an empty list.

        • twhite6878

          Thanks. I figured I should have used filter but I just wanted to see if map could do what I wanted. 🙂