High Order Function: A higher order function is a function that takes in a function as an argument, or returns a function.
Below are the list of common function to work with array loops.
1. forEach(): Executes a block of code against every element of the array.
2. reduce(): It is used to reduce the array to a single value and executes a provided function for each value of the array (from left-to-right) and the return value of the function is stored in an accumulator.
Syntax:
array.reduce( function(total, currentValue, currentIndex, arr), initialValue )
3. map(): Applies modification to the array. It returns a new array.
4. filter(): Filter out the unnecessary elements from array. It returns a new array.
5. find(): It returns the first element, if any, that meets the condition. Once the element is found, it is immediately returned.
6. some(): Sometimes, we might want to find out if there is at least one element in the array that meets the conditions. It returns a boolean value that tells us whether or not such an element exists
7.every(): Finally, we might want to find out if every element in the array meets a certain condition. Likewise, every() returns true if all elements meet the condition, and returns false otherwise.