ES6 Map, Filter, Reduce Flashcards
1
Q
array.map( )
A
Receives a function as a parameter (a callback function). The callback function is getting executed on each element of the array, one by one.
2
Q
array.filter( )
A
returns a new array, if the callback function returns true, the current element will be in the resulting array. If it returns false, it won’t be.
3
Q
array.reduce( )
A
generates a single value or object from an array. the two parameters used in the callback function are respectively the so called accumulator and the current element.