[JavaScript] 纯文本查看 复制代码
//添加数值下标
var array = [];
array["a"] = "hello";
array["b"] = "world";
array["c"] = "yes";
array[100] = 100;
console.log(array);
console.log("length: " + array.length);//101
//添加字符串数字下标
var array = [];
array["a"] = "hello";
array["b"] = "world";
array["c"] = "yes";
array['100'] = 100;
console.log(array);
console.log("length: " + array.length);//101