Tutorials Modern JavaScript (ES6+) for Beginners

Array Methods — map, filter, find & reduce

Learn Array Methods — map, filter, find & reduce in our free Modern JavaScript (ES6+) for Beginners series. Step-by-step explanations, examples, and interview tips on Toolliyo Academy.

On this page
Array Methods — map, filter, find & reduce
Lesson 8 of 12 · Part 3 — Data & Collections · Modern JavaScript (ES6+) for Beginners
Course: Modern JavaScript (ES6+) for Beginners · Lesson: 8/12 · Read time: ~20 min · Level: Beginner · ES version: ES2015 (ES6) and above

Array Methods — map, filter, find & reduce

These four methods replace most for loops in real apps. React renders lists with map. APIs return arrays you filter and reduce for totals. Master these before React — you will use them every day.

map — transform each item

const prices = [499, 999, 0];
const withGst = prices.map(p => Math.round(p * 1.18));
// [589, 1179, 0]

const courses = [{ title: 'ES6' }, { title: 'React' }];
const titles = courses.map(c => c.title);
// ['ES6', 'React']

filter — keep matching items

const ebooks = [
  { title: 'Node', price: 499, free: false },
  { title: 'Intro JS', price: 0, free: true }
];
const freeBooks = ebooks.filter(b => b.free || b.price === 0);

find — first match

const user = users.find(u => u.email === 'alex@toolliyo.com');

reduce — single result

const orders = [{ total: 500 }, { total: 1200 }, { total: 300 }];
const revenue = orders.reduce((sum, o) => sum + o.total, 0);
// 2000
🌍 Real-world example — Dashboard: top free courses
const catalog = [
  { title: 'ES6 Basics', enrollments: 1200, free: true },
  { title: 'React Pro', enrollments: 800, free: false },
  { title: 'Node Chat', enrollments: 950, free: true }
];

const freeEnrollmentTotal = catalog
  .filter(c => c.free)
  .map(c => c.enrollments)
  .reduce((a, b) => a + b, 0);

console.log(freeEnrollmentTotal); // 2150
💡 Tip: Chain methods: filter → map → reduce. Read left to right as a pipeline.
⚠️ Common Mistake: Using map when you mean forEach — map builds a new array; if you ignore the return value, use forEach instead.
👨‍🏫 Teaching note: Live exercise: given 10 product objects, return names of items under ₹500 sorted by price — filter + map + sort.

Continue learning

Previous: Default Parameters & Object Shorthand

Next: for...of, Sets & Maps Essentials

Course home: All 12 lessons

Interview prep for this lesson

Practice these questions aloud after reading—each links to a full structured answer.

Junior Detailed
Explain JavaScript in the context of Modern JavaScript (ES6+) for Beginners.
Short answer: JavaScript runs single-threaded with an event loop. Closures capture lexical scope; promises/async handle I/O without blocking the UI thread. How to structure your answer (60–90 seconds) Define JavaScript i…
Mid Detailed
What are common mistakes teams make with Components when using Modern JavaScript (ES6+) for Beginners?
Short answer: Interviewers want a crisp definition, a practical example from your projects, and awareness of trade-offs—not textbook dumps. How to structure your answer (60–90 seconds) Define Components in plain language…
Senior Detailed
How would you debug a production issue related to State in a Modern JavaScript (ES6+) for Beginners application?
Short answer: Interviewers want a crisp definition, a practical example from your projects, and awareness of trade-offs—not textbook dumps. How to structure your answer (60–90 seconds) Define State in plain language for…
Mid Detailed
Compare two approaches to API integration—when would you choose each?
Short answer: Interviewers want a crisp definition, a practical example from your projects, and awareness of trade-offs—not textbook dumps. How to structure your answer (60–90 seconds) Define API integration in plain lan…
Junior Detailed
Describe a real-world scenario where Performance mattered in a Modern JavaScript (ES6+) for Beginners project.
Short answer: Interviewers want a crisp definition, a practical example from your projects, and awareness of trade-offs—not textbook dumps. How to structure your answer (60–90 seconds) Define Performance in plain languag…
Questions on this lesson 0

Sign in to ask a question or upvote helpful answers.

No questions yet — be the first to ask!

Modern JavaScript (ES6+) for Beginners
Course syllabus
Part 1 — Modern Basics
Part 2 — Write Less Code
Part 3 — Data & Collections
Part 4 — Async & Modules
Toolliyo Assistant
Ask about tutorials, ebooks, training, pricing, mentor services, and support. I use public site content only—not admin or internal tools.

care@toolliyo.com

Need callback? Share your details