High Order Functions

Last week we looked at the call-back functions, this week we will look at high-order functions. So what are high order functions? High order functions is a function that takes a function as an argument, then returns a function. JavaScript has a lot of built-in high order functions that are very useful, these are map, filter, sort, reduce and bind are just a few to mention. Now you might ask yourself when is a good time to use higher-order functions. They are useful when you want to customize the behavior of a certain function or you want to use a function to do the same thing over and over. Using these functions will also make your code cleaner, easier to read, and have fewer bugs.

.Map()

.Filter()

Now that you see the syntax I will show you a real life example to give you a better idea.

.Sort()

.Reduce()

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store