Few higher order functions in Javascript are map, filter, reduce, forEach.
map: creates an array by calling a specific function on each element present in the parent array. Generally map() method is used to iterate over an array and calling function on every element of array.
Syntax: array.map(function(currentValue, index, arr), thisValue)
filter: creates a new array filled with elements that pass a test provided by a function. The filter() method does not execute the function for empty elements. The filter() method does not change the original array.
Syntax: array.filter(function(currentValue, index, arr), thisValue)
reduce: executes a reducer function for array element. The reduce() method returns a single value: the function's accumulated result. The reduce() method does not execute the function for empty array elements. The reduce() method does not change the original array.
Syntax: array.reduce(function(total, currentValue, currentIndex, arr), initialValue)
forEach: The forEach() method is also used to loop through arrays, but it uses a function differently than the classic “for loop”. It passes a callback function for each element of an array together with the below parameters: Current Value (required): The value of the current array element Index (optional): The index number of the current element Array (optional): The array object the current element belongs to
Syntax: array.forEach(function(currentValue, index, arr), thisValue)