codeburst

Bursts of code to power through your day. Web Development articles, tutorials, and news.

Follow publication

Code Can Benefit Life Too

7 Ways Higher Order Functions Can Help Improve Your Life

Adopt Higher Order Functions While You Still Can

jsmanifest
codeburst
Published in
7 min readJun 21, 2019

One of the fundamental building blocks of JavaScript are functions. That’s enough to intrigue anyone about the semantics of functions when learning JavaScript.

But functions are much more intriguing than that.

“Like what”, you ask?

They can become higher order functions — functions that take other functions as arguments, or functions that return functions as their output.

There’s a whole lot of functions going on in that line — and JavaScript is no different. In JavaScript, functions are everywhere. And you should feel blessed that they are!

Here are 7 Ways Higher Order Functions Can Improve Your Life:

1. They Enhance Your Existing Code, Increasing Confidence

Imagine a function who’s task is to retrieve a list of frogs from an API, uses the returned list to calculate the average width of tongues of the frogs and returns the result.

An example would be something like:

As it is now, we are restricted to only returning a number. But what if there was a way to transform it into an object without changing the original function?

The enhancement here is having the ability to pass in additional options to customize and transform the output for better control:

2. They Save Precious…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Published in codeburst

Bursts of code to power through your day. Web Development articles, tutorials, and news.

Written by jsmanifest

Team Lead Front End Developer for a TeleMedicine Company. Follow and Join Me on my Adventures. https://jsmanifest.com

Responses (3)

Write a response