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);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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*);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly