js相对lua语法需要注意问题
2019-10-27 本文已影响0人
SuperGino
1.问题:数值循环如果中间没有赋值会不会中断遍历,如果不中断那么值是什么
let test = []
test[0] = 1
test[2] = 1
for (let index = 0; index < test.length; index++) {
const element = test[index]
console.log(element)
}
// 结果打印
1
undefined
1