JavaScript Array Methods You Should Know

  • Admin
  • 1 min read

Why Array Methods Matter

Modern JavaScript gives you built-in methods that replace most manual for loops for transforming and filtering data. Learning these five will cover the vast majority of everyday tasks.

map() — Transform Every Item

map() returns a new array where each item has been transformed by a function you provide.

const prices = [100, 200, 300]; const withTax = prices.map(p => p * 1.18); console.log(withTax); // [118, 236, 354]

filter() — Keep Only What Matches

const ages = [12, 18, 25, 16, 30]; const adults = ages.filter(age => age >= 18); console.log(adults); // [18, 25, 30]

reduce() — Collapse to a Single Value

reduce() is the most powerful and most confusing at first. It walks through the array, accumulating a result.

const cart = [250, 400, 150]; const total = cart.reduce((sum, price) => sum + price, 0); console.log(total); // 800

find() and some()/every()

const users = [{id: 1, active: true}, {id: 2, active: false}]; const first = users.find(u => u.active); // the object itself const anyActive = users.some(u => u.active); // true const allActive = users.every(u => u.active); // false

Chaining Methods

Because each method returns a new array, you can chain them for readable pipelines:

const result = [1,2,3,4,5,6] .filter(n => n % 2 === 0) .map(n => n * 10); console.log(result); // [20, 40, 60]

Practice Exercise

Given an array of order objects {amount, status}, use filter and reduce to calculate the total amount of only the “completed” orders.

Admin

About the author

Admin

Instructor and technical writer at tutorials.in

Writes beginner lessons for tutorials.in. Each lesson is checked against the language or tool documentation, and examples are run before publishing.

Reviewed by the editorial team before publishing. Last updated August 9, 2026.

Ask a question

Be specific about what you tried. Questions with a code sample and the exact error message are answered fastest.