You don’t need to memorize every array method in JavaScript — trust me, after working on enough real-life front-end projects, I’ve learned that just five of them come up constantly. These are the ones I keep using over and over again in actual code, not just tutorials or interview prep.
These are the ones I reach for 90% of the time:
1. map()
Transforms every item in an array and returns a new array.
const prices = [10, 20, 30];
const withTax = prices.map(p => p * 1.1);
// [11, 22, 33]
When to use: You want to transform data — not filter or reduce it, just shape it.
2. filter()
Returns a new array that only includes items that pass a test.
const ages = [12, 25, 18, 40];
const adults = ages.filter(age => age >= 18);
// [25, 18, 40]
When to use: You want to remove stuff based on a condition.
3. reduce()
Boils down an array to a single value.
const scores = [80, 90, 100];
const total = scores.reduce((sum, score) => sum + score, 0);
// 270
When to use: You want to accumulate values — like totals, averages, or even objects.
4. find()
Returns the first item that matches a condition — or undefined if none match.
const users = [{ name: "Ana" }, { name: "Ben" }];
const user = users.find(u => u.name === "Ben");
// { name: "Ben" }
When to use: You want a single match, not a filtered list.
5. forEach()
Runs a function on each item in the array, but doesn’t return anything.
const colors = ["red", "green", "blue"];
colors.forEach(color => console.log(color));
When to use: You want to do something (like logging or DOM manipulation) with each item — not build a new array.
Wrap-Up
Yes, there are more array methods out there — but if you're comfortable with these five, you're already ahead of the game.
They come up in interviews, real-world projects, and almost every codebase you'll work with.
Master these, and the rest will feel like variations on a theme.
Top comments (1)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.