Array- Filter Flashcards

1
Q

What does Array.filter do?

A

creates a shallow copy of a portion of a given array, filtered down to just the elements from the given array that pass the test implemented by the provided function.

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

What should the callback function return?

A

It should return a truthy to keep the element in the resulting array, and a falsy value otherwise.

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

What is Array.filter useful for?

A

finding values or pulling values that are wanted out of an array.

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