One thing I have found to be of vital importance when learning something new, is learning and using the correct terminology. Doing this not only helps you as your learn on your own, but it also makes it easier to communicate with, and ask others for help. With that in mind, I would like to devote this week's blog post to some key functional programming terms that you will definitely encounter.
The first term that you have no doubt already used, but maybe didn't know what it is called are "callbacks." If you have used the .filter() array method you have used a callback. In a nut shell, a callback function is a function that is passed into another function to decide the invocation of that function. In the case of .filter(), the callback function sets the criteria for how we filter an array.
There are also "first class functions," which are functions that can be assigned to a variable, passed into another function, or returned from another function just like any other normal value. The beauty of JavaScript is that all functions are first class functions.
There are also "higher-order functions," which are the functions that take a function as an argument, or return a function as a return value. Again, you have most likely already been using higher-order functions like .filter(), .map(), and .reduce().
The last term I want to touch on are "lamda" functions. Lamda functions are when the functions are passed in to another function or returned from another function, then those functions which gets passed in or returned can be called a lambda.
Functional programming is a vast topic, but I hope that this introduction to some of the key terms aides you in your quest to learn JavaScript.
Top comments (0)