The array constructor documentation shows the following
var arr1 = new Array(arrayLength);
var arr2 = new Array(element0, element1, ..., elementN);
So, if you use only one parameter, it creates an array arrayLength; otherwise, if you use more than one, it will populate the array with these values.
However, as others have indicated, it is best to use a literal notation *
var node = [
[6, 7],
[5, -4 8],
[-2]
];
* Writing an array literally is a little bit faster than new Array(), but it is micro-optimization and not very important in most cases.
source
share