This is a categorized list of all native JavaScript array methods and properties grouped by the type of tasks they perform.

  1. Mutating
    1. Add
    2. Remove
    3. Add / Remove
    4. Move
  2. Accessing
    1. Add
    2. Remove
    3. Find
    4. Transforming
  3. Iterating
  4. Static properties & methods

Mutating

Add

push();
unshift();

Remove

pop();
shift();

Add / Remove

splice();
fill();

Move

copyWithin();
sort();
reverse();

Accessing

Add

concat();

Remove

slice();
filter();

Find

includes();
indexOf();
lastIndexOf();

Transforming

join();
toString();
toLocaleString();
toSource();

Iterating

map();
reduce();
reduceRight();
find();
findIndex();
forEach();
every();
some();
keys();
values();
entries();

Static properties & methods

.length
isArray()
from()
of()

Code Samples

push()

const a = [1, 2, 3];
const res = a.push(4, 5);
console.log(a, res);

// [ 1, 2, 3, 4, 5 ]   5

unshift()

const a = [1, 2, 3];
const res = a.unshift(-1, 0);
console.log(a, res);

// [ -1, 0, 1, 2, 3 ]   5

pop()

const a = [1, 2, 3];
const res = a.pop();
console.log(a, res);

// [ 1, 2 ]   3

shift()

const a = [1, 2, 3];
const res = a.shift();
console.log(a, res);

// [ 2, 3 ]   1

splice()

const a = [1, 2, 3];
const res = a.splice(1, 1, "two");
console.log(a, res);

// [ 1, "two", 3 ]   [ 2 ]

fill()

const a = [1, 2, 3];
const res = a.fill(4, 1);
console.log(a, res);

// [ 1, 4, 4 ]   [ 1, 4, 4 ]

copyWithin()

const a = [1, 2, 3];
const res = a.copyWithin(1, 0);
console.log(a, res);

// [ 1, 1, 2 ]   [ 1, 1, 2 ]

sort()

const a = [2, 1, 3];
const res = a.sort();
console.log(a, res);

// [ 1, 2, 3 ]   [ 1, 2, 3 ]

reverse()

const a = [1, 2, 3];
const res = a.reverse();
console.log(a, res);

// [ 3, 2, 1 ]   [ 3, 2, 1 ]

concat()

const a = [1, 2, 3];
const res = a.concat(4);
console.log(a, res);

// [ 1, 2, 3 ]   [ 1, 2, 3, 4 ]

slice()

const a = [1, 2, 3];
const res = a.slice(1, 2);
console.log(a, res);

// [ 1, 2, 3 ]   [ 2 ]

filter()

const a = [1, 2, 3];
const res = a.filter((num) => num > 1);
console.log(a, res);

// [ 1, 2, 3 ]   [ 2, 3 ]

includes()

const a = [1, 2, 3];
const res = a.includes(4);
console.log(a, res);

// [ 1, 2, 3 ]   false

indexOf()

const a = [1, 2, 3];
const res = a.indexOf(3);
console.log(a, res);

// [ 1, 2, 3 ]   2

lastIndexOf()

const a = [1, 2, 1];
const res = a.lastIndexOf(1);
console.log(a, res);

// [ 1, 2, 3 ]   2

join()

const a = [1, 2, 3];
const res = a.join("-");
console.log(a, res);

// [ 1, 2, 3 ]   1-2-3

toString()

const a = [1, 2, 3];
const res = a.toString();
console.log(a, res);

// [ 1, 2, 3 ]   1,2,3

toLocaleString()

const a = [1, 2, 3];
const res = a.toLocaleString("en-GB", {
  style: "currency",
  currency: "GBP",
});
console.log(a, res);

// [ 1, 2, 3 ]   £1.00,£2.00,£3.00

toSource()

const a = [1, 2, 3];
const res = a.toSource();
console.log(a, res);

// [ 1, 2, 3 ]   "[1, 2, 3]"

map()

const a = [1, 2, 3];
const res = a.map((num) => num * 10);
console.log(a, res);

// [ 1, 2, 3 ]   [ 10, 20, 30 ]

reduce()

const a = [1, 2, 3];
const res = a.reduce((acc, cur) => acc - cur);
console.log(a, res);

// [ 1, 2, 3 ]   -4

reduceRight()

const a = [1, 2, 3];
const res = a.reduceRight((acc, cur) => acc - cur);
console.log(a, res);

// [ 1, 2, 3 ]   0

find()

const a = [1, 2, 3];
const res = a.find((num) => num % 2 === 0);
console.log(a, res);

// [ 1, 2, 3 ]   2

findIndex()

const a = [1, 2, 3];
const res = a.findIndex((num) => num === 3);
console.log(a, res);

// [ 1, 2, 3 ]   2

forEach()

const a = [1, 2, 3];
a.forEach((num) => console.log(num));

// 1
// 2
// 3

every()

const a = [1, 2, 3];
const res = a.every((num) => num > 0);
console.log(a, res);

// [ 1, 2, 3 ]   true

some()

const a = [1, 2, 3];
const res = a.some((num) => num > 2);
console.log(a, res);

// [ 1, 2, 3 ]   true

keys()

const a = [1, 2, 3];
const res = a.keys();
console.log(a, [...res]);

// [ 1, 2, 3 ]   [ 0, 1, 2 ]

values()

const a = [1, 2, 3];
const res = a.values();
console.log(a, res.next());

// [ 1, 2, 3 ]   { value: 1, done: false }

entries()

const a = [1, 2, 3];
const res = a.entries();
console.log(a, res.next());

// [ 1, 2, 3 ]   { value: [ 0, 1 ], done: false }

.length

const a = [1, 2, 3];
console.log(a.length);

// 3

Array.isArray

const a = [1, 2, 3];
const res = Array.isArray(a);
console.log(a, res);

// [ 1, 2, 3 ]   true

Array.from

const a = Array.from("word");
console.log(a);

// [ "w", "o", "r", "d" ]

Array.of

const a = Array.of(1, 2, 3);
console.log(a);

// [ 1, 2, 3 ]