5.2.1 Array Declaration

Arrays are initialized by enclosing comma , separated values in brackets []. A plain [] represents the empty array, whereas [1, 2, 3] initializes an array with three elements 1, 2 and 3.

var b = [];
var a = [1, 2, 3];

The generated code may be less concise on platforms that do not support array initialization. Essentially, such initialization code then looks like this:

var a = new Array();

This should be considered when deciding if a function should be inlined as it may inline more code than visible in the syntax.

Advanced initialization techniques are described in Array Comprehension.