日期:2014-05-16 浏览次数:20374 次
var arr2 = [,,,];
var arr3 = new Array(3);
console.log(0 in arr2); //false ====>书中写的true:0在arr1处有一个元素
console.log(0 in arr3); //false
console.log(arr2); // [undefined,undefined,undefined]
console.log(arr3); // [undefined,undefined,undefined]
for(var i in arr2) {
console.log(i+'='+arr2[i]) //没有显示
}
for(var i in arr3) {
console.log(i+'='+arr3[i]) //没有显示
}
var arr2 = [undefined,,,];
var arr3 = new Array(3);
console.log(0 in arr2); //true
console.log(0 in arr3); //false