Deleting undefined indexes in array Javascript
This question already has an answer here:
var array = [];
array[1] = 2;
array[3] = 4;
for(var i = 0; i < array.length; i ++) {
if(array[i]) {
} else {
array.splice(i, 1);
}
}
console.log(array)
链接地址: http://www.djcxy.com/p/37744.html
上一篇: 不同的变量数组