qq_花开花谢_0
这是有区别的,但在这个例子中没有区别。使用更详细的方法:new Array()参数中确实有一个额外的选项:如果将一个数字传递给构造函数,您将得到一个长度为该长度的数组:x = new Array(5);alert(x.length); // 5为了说明创建数组的不同方法:var a = [], // these are the same
b = new Array(), // a and b are arrays with length 0
c = ['foo', 'bar'], // these are the same
d = new Array('foo', 'bar'), // c and d are arrays with 2 strings
// these are different:
e = [3] // e.length == 1, e[0] == 3
f = new Array(3), // f.length == 3, f[0] == undefined;