- Map, Filter, Reduce are the higher-order function in javascript.
Map
- The map function is used to transform an array.
- Suppose you have this array
Map Example
Filter()
- The filter function is used to filter values present inside the array.
- Let's say if you want to filter out al the values which are odd, or greater than 3 inside it, or divisible by 3.
- Used to filter the data based on condition.
Filter Example
Reduce()
- As the name suggests Reduce doesn't Reduce anything :D
- Reduce can be used to iterate over each & every element of an array & find the sum of all the elements in the array. or the largest or the max element inside the array.
- Instead of directly going to write Reduce Method we will just check the above (p2) example in a Non-Functional way.
