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
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
本文标题:js相对lua语法需要注意问题
本文链接:https://www.haomeiwen.com/subject/crtmvctx.html
网友评论