Array Methods (map, filter, reduce) — Free JavaScript Tutorial
Learn Array Methods (map, filter, reduce) in JavaScript with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.in.
TL;DR: Learn Array Methods (map, filter, reduce) in JavaScript with a free, beginner-friendly tutorial, examples and practice for Indian students on Syllab.i…
Written & reviewed by the Syllab.in Academic Team (CBSE/NCERT subject experts) · Updated
Array Methods (map, filter, reduce) in JavaScript
Modern JavaScript array methods process arrays without for loops. They are cleaner, more readable, and chainable.
map() transforms each element and returns a NEW array. filter() keeps only elements that pass a test. reduce() accumulates all elements into a single value.
find() returns the first matching element. some() checks if ANY element passes. every() checks if ALL pass. forEach() runs a function on each (no return).
These methods can be chained: students.filter(s => s.marks >= 60).map(s => s.name) — get names of passing students.
Array Methods (map, filter, reduce) — Syntax
const nums = [1, 2, 3, 4, 5]; nums.map(n => n * 2) // [2, 4, 6, 8, 10] nums.filter(n => n % 2 === 0) // [2, 4] nums.reduce((sum, n) => sum + n, 0) // 15 nums.find(n => n > 3) // 4 nums.some(n => n > 4) // true nums.every(n => n > 0) // true
Learn Array Methods (map, filter, reduce) step by step with Syllab's free interactive JavaScript tutorial — runnable code examples, practice exercises and instant AI feedback, all free with no signup. Explore the full JavaScript course →