This article is a stub. You can help the JavaScript Wiki by expanding it.

An array is a collection of values stored in a list that can be accessed by position. The array literal is a comma-separated list of values enclosed in square brackets.

Visualizing it Edit

The array data-structure is much like a bin of numbered pages. (Whereas the object data-structure is like a file cabinet.)


These properties and methods are available on the global Array constructor.


Data type object
Standard ECMA-262 §
Documentation Mozilla, Microsoft

These members are available on each instance of Array. (This includes array literals.)


Data type function
Return type string
Parameter list [separator (string)]
Standard ECMA-262 §
Documentation Mozilla Microsoft

Joins all elements of an array into a string.


Optional. Specifies a string to separate each element of the array. The separator is converted to a string if necessary. If omitted, the array elements are separated with a comma.


Data type function
Return type array
Parameter list index (number), howMany (number), [element1][, ..., elementN] (any type)
Standard ECMA-262 §
Documentation Mozilla, Microsoft

Changes the content of an array, adding new elements while removing old elements.


Index at which to start changing the array. If negative, will begin that many elements from the end.


An integer indicating the number of old array elements to remove. If howMany is 0, no elements are removed. In this case, you should specify at least one new element.

element1, ..., elementNEdit

Optional. The elements to add to the array. If you don't specify any elements, splice simply removes elements from the array.


External Links Edit

Community content is available under CC-BY-SA unless otherwise noted.