JavaScript 2025 · Arrays

Keep matching items

Create a new array with the items that pass a test.

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

Official JavaScript 2025 documentation

More arrays commands

All arrays commands · JavaScript 2025 cheatsheet

Was this page helpful?