Today I revisited the topic of functional programming. However, this time around because of the course by Anthony Alicea it makes a lot more sense. It makes a lot more sense now that I understand that JavaScript is dynamically typed and because of that it is able to class functions as object which can contain Boolean, objects, numbers, and strings. With this ability functions are able to become first class functions which in turn can reference to other functions.

Functional programming is to think and code in terms of functions. The example was an array and looping over an array. He did this by creating a for loop then push the array to change value. Lastly console.log to invoke it.

The functional programming method was to use first class functions. To do this Alicea created a function with an array and function in the parenthesis. In object literal curly braces he made a new anonymous variable with a for loop and pushed a function. Called a function and passed in the array item. In short create a new array, loop over the array given and add to the new array for every item given, which is also processed by a function also given. This made the same function created in the first example much shorter by just making a variable equal to the new function object.

I noticed that it made it easier to add on new functions with this method in a shorter cleaner way. It is making me think that being able to read code is more important than being able to write code. Since the main problem to solve is fixing problems as a developer.

Leave a comment

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: