Array Methods

The following table displays a summary of the array methods. Detailed descriptions of each method follow the table.

MethodDescription

concat

Joins two arrays and returns a new array.

join

Joins all elements of an array into a string.

pop

Removes the last element from an array and returns that element.

push

Adds one or more elements to the end of an array and returns that last element added.

reverse

Transposes the elements of an array: the first array element becomes the last and the last becomes the first.

shift

Removes the first element from an array and returns that element.

slice

Extracts a section of an array and returns a new array.

splice

Adds and/or removes elements from an array.

sort

Sorts the elements of an array.

toString

Returns a string representing the specified object.

unshift

Adds one or more elements to the front of an array and returns the new length of the array.