cover-img

JavaScript Higher Order Functions Cheatsheet

JavaScript

26 October, 2022

1

1

0

1.

map: Calls a defined callback function on each element of an array, and returns an array that contains the results.

2.

forEach: Performs the specified action for each element in an array.

3.

filter: Returns the elements of an array that meet the condition specified in a callback function.

4.

find: Returns the value of the first element in the array where the predicate is true, and undefined otherwise.

5.

some: Determines whether the specified callback function returns true for any element of an array.

6.

reduce: Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result and is provided as an argument in the next call to the callback function.

7.

every: Determines whether all the members of an array satisfy the specified test.

8.

findIndex: Returns the index of the first element in the array where the predicate is true, and -1 otherwise.

9.

sort: Sorts an array in place. This method mutates the array and returns a reference to the same array.
JavaScript Higher Order Functions Cheatsheet
img

JavaScript Higher Order Functions Cheatsheet

Difference between map and forEach:

forEach: This iterates over a list and applies some operation with side effects to each list member and does not return anything. Similar to for loop
map: This iterates over a list, transforms each member of that list and returns another list of the same size with the transformed members. It does not mutate the array on which it is called.

1

1

0

Sarath Adhithya
Full Stack Developer | Blockchain Enthusiast | Frontend ❤️

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2025. Showcase Creators Inc. All rights reserved.