JavaScript · Array Methods · Interactive

Array Methods,
explained for humans

All 41 Array methods illustrated with real scenarios — shopping carts, playlists, delivery queues. No dry theory.

example.js
// Real problems, real methods
const cart = [
  { name: 'Shoes',  price: 2499 },
  { name: 'Hat',    price: 399  },
];
// Filter under ₹500
cart.filter(i => i.price < 500); // [{Hat}]
// Apply 10% discount
cart.map(i => ({...i, price: i.price * 0.9}));
// Calculate total
cart.reduce((s, i) => s + i.price, 0); // 2898

5 real-world scenarios

All methods at a glance

Mutates
push()pop()shift()unshift()splice()sort()reverse()fill()
New array
map()filter()slice()concat()flat()flatMap()toReversed()toSorted()with()
Iterative
forEach()reduce()every()some()entries()keys()values()
find()findIndex()findLast()includes()indexOf()at()
View full reference →