filter()
Keeps only the items that pass a test.
What does filter() do in JavaScript?
filter() — Keeps only the items that pass a test.
const prices = [2, 7, 3];
const affordable = prices.filter(price => price < 5);
Level: Journeyman · More JavaScript terms at this level
Updated