Arrays Flashcards
1
Q
array.filter()
A
The filter() method creates a new array with all elements that pass the test implemented by the provided function. If no elements pass the test, an empty array will be returned.
Syntax: let newArray = array.filter((element, index, array) => condition);
2
Q
array.map()
A
The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.
Syntax: let newArray = array.map((currentValue, index, array) => {code block}, thisArg*);