Back to resources
cheatsheet7 min readBeginner to Intermediate

JavaScript Array Cheatsheet

Quick reference for array methods frequently asked in coding interviews.

JavaScriptArraysQuick Revision

Core methods to remember

  • map transforms each element and returns a new array.
  • filter keeps elements that satisfy a condition.
  • reduce folds an array into a single value.
  • find returns the first matching element.
  • some and every return boolean checks.

Common interview snippets

const nums = [1, 2, 3, 4, 5];
const squares = nums.map((num) => num * num);
const even = nums.filter((num) => num % 2 === 0);
const total = nums.reduce((sum, num) => sum + num, 0);

Tricky points interviewers check

  1. Difference between mutating and non-mutating methods.
  2. Time complexity of nested array operations.
  3. Handling empty arrays in reduce.
  4. Distinguishing splice vs slice.

Revise this once before every coding round to avoid simple mistakes.