JavaScript Array object



Array object

Array object is used to store multiple values ​​in variables:

var cars = ["Saab", "Volvo", "BMW"];

The first array element The index value is 0, the second index value is 1, and so on.

For more information about the JavaScript Array reference manual, please refer to the JavaScript Array Object Manual.


Array Object Properties

MethodDescription
concat() Concatenate two or more arrays and return the result.
every()Check whether each element of the numerical element meets the conditions.
filter()Detects numeric elements and returns an array of all elements that meet the conditions.
indexOf()Search for an element in the array and return its position.
join()Put all elements of the array into a string.
lastIndexOf()Returns the last occurrence position of a specified string value, searching from back to front at the specified position in a string.
map()Processes each element of the array through the specified function and returns the processed array.
pop()Deletes the last element of the array and returns the deleted element.
push()Adds one or more elements to the end of the array and returns the new length.
reverse()Reverse the order of the elements of the array.
shift()Deletes and returns the first element of the array.
slice()Select a part of the array and return a new array.
some()Detects whether any element in the array element meets the specified condition.
sort() Sort the elements of the array.
splice()Add or remove elements from an array.
toString()Convert the array to a string and return the result.
unshift()Adds one or more elements to the beginning of the array and returns the new length.
valueOf()Returns the original value of the array object.