LearnFrenzy
Sign in Take a free test

Array Methods · Array Methods MCQ · Question 5

find vs filter Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links