Latest web development tutorials

JavaScript Array Object

Array Objects

Array object is used to store multiple values ​​in a variable:

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

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

For more information about JavaScript Array Reference Manual Refer JavaScript Array Objects manual .


Array Object Properties

method description
concat () Connect two or more arrays, and returns the result.
every () Detecting whether each element value element are eligible.
filter () Sensed value element, and returns all qualifying element of the array.
indexOf () Search for elements in the array, and returns its location.
join () All the elements of the array into a string.
lastIndexOf () Returns the value of a specified string last occurrence of a string in the specified location from the search forward.
map () Through each element of the specified function to handle an array and returns an array of post-processing.
pop () Remove the last element of the array and returns the deleted element.
push () Adds one or more elements to the end of an array and returns the new length.
reverse () Reverse the order of elements in the array.
shift () Removes and returns the first element of the array.
slice () Select a part of an array and returns a new array.
some () Detecting whether there are elements in the array elements that meet the specified criteria.
sort () Of the elements of the array to be sorted.
splice () Add or remove elements from an array.
toString () The array is converted to a string and returns the result.
unshift () Adds one or more elements to the beginning of an array and returns the new length.
valueOf () Returns the original value of the array of objects.