Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript Array []

JavaScript Array [ ]

Array Object Reference JavaScript Array object

Example

Create an array:

let

arr

=

[

1

,

2

,

3

]

;

//

Create an array containing 1, 2, 3

arr Output result:

1,2,3

Try it »


Definition and Usage

The [ ] constructor creates a new array object.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari


Syntax

[iterable]

Parameters

Parameters Description
iterable Required. An iterable object with values.

Return Value

Type Description
Array object Returns an array object.

Array Object Reference JavaScript Array object