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
JavaScript 2025 · Arrays
Create a new array with the items that pass a test.
const adults = users.filter((u) => u.age >= 18);
Official JavaScript 2025 documentation
Was this page helpful?