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.
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.
3
Q
What is Array.filter useful for?
A
finding values or pulling values that are wanted out of an array.