数组
创建数组
创建数组的最简单方法是使用数组字面值:
var empty = []; // An array with no elements
var primes = [2, 3, 5, 7, 11]; // An array with 5 numeric elements
var misc = [1.1, true, "a",]; // 3 elements of various types + trailing comma
数组字面值中的元素可以是任意的表达式。如果数组中有省略的元素,其值为undefined: