Question 5
Back to Exercise
What is the difference between find and filter?
- A They are identical
- B find returns an index; filter returns elements
- C find mutates the array; filter does not
- D find returns the first matching element (or undefined); filter returns an array of all matches Correct
Correct Answer: Option D
find stops at the first match and returns the element itself. filter always returns an array, possibly empty.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!