Back to Blog
Reference2026-04-18

Array Methods Cheatsheet for 2026

Quick reference for every Array method including the new immutable variants.

JavaScript arrays gained a wave of immutable methods in ES2023 and iterator helpers in ES2025-26. Here is the practical cheatsheet.

Mutating vs Non-Mutating

The classic mutators (push, pop, shift, unshift, splice, sort, reverse) modify in place. Their non-mutating versions:

| Mutating | Non-mutating | |----------|--------------| | sort | toSorted | | reverse | toReversed | | splice | toSpliced | | arr[i] = x | with(i, x) |

``js const sorted = scores.toSorted((a, b) => b - a); const updated = items.with(2, newItem); `

These return a new array; great for React/Svelte state.

Search and Test

- find, findIndex — first match - findLast, findLastIndex — last match (ES2023) - includes — does it contain x - some, every — boolean tests - indexOf, lastIndexOf — index by value

Transform

- map — 1:1 transform - filter — keep matching - flatMap — map then flatten one level - reduce — fold to single value - flat(depth) — flatten nested arrays

Iteration Helpers (ES2025+)

`js const top10 = source.values() .filter(isValid) .map(normalize) .take(10) .toArray(); `

Works on any iterator, lazy, no intermediate arrays.

Group

`js const byCategory = Object.groupBy(items, x => x.category); const map = Map.groupBy(items, x => x.category); // Map version `

Object.groupBy and Map.groupBy shipped in 2024 across major engines.

Set Methods Apply

When working with unique values, Set now has union/intersection/difference. Convert with new Set(arr) and [...set]`.

For runtime semantics see [JavaScript event loop explained](/blog/javascript-event-loop-explained).