JavaScript: Array Methods Cheatsheet

Tim Han
4 min readMar 13, 2019

Here is a list of most common array methods in JavaScript.

// Mutating
push() // Insert an element at the end
pop() // Remove an element from the end
unshift() // Inserts an element in the beginning
shift() // Remove first element
// Iterating
forEach() // Iterates an array
filter() // Iterates an array and result is filtered array
map() // Iterates an array and result is new array
reduce() // "Reduces" the array into single value (accumulator)
// Others
slice() // Returns desired elements in a new array
concat() // Append one or more arrays with given array

Mutating Methods

There are many array methods that mutate the array. Mutating an array means that the resulting array will take a different form from before similar to English definition of mutation. So let’s take a look at some of the most common ones:

push()

const array = [1, 2, 3, 4]array.push(10) // 5 (push returns the length of the new array)// array = [1, 2, 3, 4, 10]

push method will insert the element passed at the end of the array and return the length of the new array.

pop()

--

--