RUNWEBTOOLS
English

JavaScript Array Methods Cheat Sheet

The JavaScript array methods you reach for most, with what each returns and — crucially — whether it mutates the original array or returns a new one. Getting that column right prevents a whole class of bugs: methods like map and filter are safe because they leave the original untouched, while sort, reverse, and splice change it in place.

Updated 2026-07-06

MethodWhat it doesReturnsMutates
map()Transform every elementNew arrayNo
filter()Keep elements that pass a testNew arrayNo
reduce()Boil the array down to a single valueAny valueNo
forEach()Run a function for each elementundefinedNo
find()First element that passes a testElement / undefinedNo
findIndex()Index of the first matchIndex / -1No
some()True if at least one passesBooleanNo
every()True if all passBooleanNo
includes()Whether a value is presentBooleanNo
indexOf()Index of a valueIndex / -1No
slice()Copy a portion of the arrayNew arrayNo
concat()Merge arrays into a new oneNew arrayNo
join()Combine elements into a stringStringNo
flat()Flatten nested arraysNew arrayNo
flatMap()map() then flatten one levelNew arrayNo
at()Element by index (supports negatives)ElementNo
push()Add one or more items to the endNew lengthYes
pop()Remove the last itemRemoved itemYes
shift()Remove the first itemRemoved itemYes
unshift()Add items to the startNew lengthYes
splice()Add/remove items at any indexRemoved itemsYes
sort()Sort the array in placeThe arrayYes
reverse()Reverse the array in placeThe arrayYes
fill()Fill with a static valueThe arrayYes
Array.from()Create an array from an iterableNew arrayNo
Array.isArray()Check if a value is an arrayBooleanNo

Tip: when you need a sorted copy without touching the original, spread first — [...arr].sort(). Modern JavaScript also adds non-mutating twins (toSorted, toReversed, toSpliced, with) that return a new array.