← Lesson
BitWithBite
Full-Stack · Quick Reference

Lesson 16 — Arrays: map/filter/reduce Cheat Sheet

Full-Stack
In one line: map/filter/reduce transform arrays without mutating the original — the backbone of how React renders lists.

The Big Four

1.map(). Transforms every item, same length out.
2.filter(). Keeps items that pass a test.
3.reduce(). Collapses to a single value.
4.find(). First match, or undefined.
5Spread (...). Copies array/object contents.

Examples

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((s,n)=>s+n, 0); // 15 nums.find(n => n>3); // 4 const withSix = [...nums, 6];