var arr = [1,2,3,4,true,'bbb',new Date()];
arr.length = 5; //通过改变Array的length属性,可以修改Array
console.log(arr); //[ 1, 2, 3, 4, true ]
arr.length = 6;
console.log(arr); //[ 1, 2, 3, 4, true, <1 empty item> ]
arr[9] = 9; //通过索引操作也可以修改array
console.log(arr); //[ 1, 2, 3, 4, true, <4 empty items>, 9 ]
05-09
8459
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountBlack.png)