Which method creates a new array with all elements that pass a test implemented by the provided function?

  • reduce()
  • forEach()
  • filter()
  • find()
The filter() method creates a new array with all elements that pass the test implemented by the provided function. It's a non-mutating method, meaning it doesn't change the original array. In contrast, reduce(), forEach(), and find() serve different purposes.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *