Data Manipulation in JavaScript
Learn how to transform, filter, and aggregate data using native JavaScript methods.
Array Methods
Common operations include map, filter, and reduce.
const numbers = [1,2,3,4,5];
const doubled = numbers.map(n => n * 2);
const evens = numbers.filter(n => n % 2 === 0);
const sum = numbers.reduce((acc,n) => acc + n, 0);
Object Manipulation
Resize, merge, and pick properties with modern syntax.
const user = {id:1, name:'Alice', role:'admin'};
const {id, ...rest} = user; // rest = {name:'Alice', role:'admin'}
const defaults = {role:'guest', active:true};
const settings = {...defaults, ...user}; // overrides defaults