JavaScript60 min total · 16 parts
JavaScript Array and Object Methods Cheat Sheet
Part 1 of 16 · ~1 min
Overview
Say you're building the little dashboard behind a hiring pipeline — the screen a recruiter looks at every morning. It holds a list of candidates: who applied, what they scored, whether they're still active in the process. Almost everything you'll do to that list, and to the objects inside it, comes down to a fairly short list of built-in methods. This reference walks through all of them, using that one dataset the whole way through, so you're not re-learning the cast of characters every three paragraphs — just the method.
Here's the dataset. Keep it in view; every example below operates on some version of it.
const candidates = [
{ id: "c1", name: "Priya Shah", role: "backend", score: 82, status: "active", yearsExperience: 8, tags: ["node", "postgres"] },
{ id: "c2", name: "Diego Ramos", role: "frontend", score: 74, status: "withdrawn", yearsExperience: 3, tags: ["react", "css"] },
{ id: "c3", name: "Amara Chen", role: "backend", score: 91, status: "active", yearsExperience: 12, tags: ["node", "postgres", "redis"] },
{ id: "c4", name: "Sam Okafor", role: "frontend", score: 68, status: "active", yearsExperience: 1, tags: ["react", "typescript"] },
{ id: "c5", name: "Lena Fischer", role: "backend", score: 59, status: "rejected", yearsExperience: 10, tags: ["node"] },
];
Five people, five plain objects, one array. Nothing exotic — which is exactly the point. Every method below either reshapes this array, reaches into one of these objects, or has an opinion about what "copying" one of them actually means.
One housekeeping note before diving in: treat each example as its own fresh run against this same five-person list. A few sections deliberately mutate candidates to demonstrate exactly that — but the next section always picks back up from the original data above, not from whatever an earlier example left behind.