Array Filter

The filter method creates a new array with all elements that pass the test implemented by the provided function.

Snippet:

const adults = users.filter(user => user.age > 18);

Example:

const evenNumbers = numbers.filter(num => num % 2 === 0);