Methods of the array object

The table below lists the methods of the Array object and provides a short description of each method.

MethodDescription
concat()Combines the elements of two or more arrays in one new array.
join()Combines the elements of an array into a single string with a separator character.
pop()Removes the last element of an array and then returns it if needed.
push()Adds elements to the end of an array then returns (if needed) the new length value of the array.
reverse()Reverses the direction of the elements in an array.
shift()Removes the first element of an array and then returns it if needed.
unshift()Adds elements to the beginning of an array then returns (if needed) the new
length value of the array.
slice()Pull out a specified section of an array then returns the section as a new array.
splice()Removes or replaces elements in an array.
sort()Sorts the elements of an array in alphabetical order based o the string values of the elements.
toString()Combines the elements of an array into a single string with a comma as a separator character.

Leave a Reply