Javascript数组

Javascript中的数组是关联数组,键不仅可以为int类型的数值,还可以为字符串。如下:

var a = [];

a['as'] = 1;  //相当于a.as = 1,为数组添加属性,不改变length

console.log(a['as']);  // 1

delete a['as'];

console.log(a['as']);  //undefined

posted @ 2016-02-25 13:33  hyqdvd  阅读(94)  评论(0)    收藏  举报