//length赋值为0
//这种方式很有意思,其它语言如Java,其数组的length是只读的,不能被赋值。如
int [] ary = { 1 , 2 , 3 , 4 };
ary.length = 0 ;
//Java中会报错,编译通不过。而JS中则可以,且将数组清空了,
var ary = [1,2,3,4];
ary.length = 0;
console.log(ary); // 输出 [],空数组,即被清空了
//目前 Prototype中数组的 clear 和mootools库中数组的 empty 使用这种方式清空数组。
参考自:https://blog.csdn.net/u010874036/article/details/51224761