for in 遍历 key(index), for of 遍历 value.
e.g:
let itemList = [1,2,3,4,5];
for (let a of itemList) {
console.log(a)
}
res: 1,2,3,4,5
let itemList = [1,2,3,4,5];
for (let a in itemList) {
console.log(a)
}
res: 0,1,2,3,4
for in 遍历 key(index), for of 遍历 value.
e.g:
let itemList = [1,2,3,4,5];
for (let a of itemList) {
console.log(a)
}
res: 1,2,3,4,5
let itemList = [1,2,3,4,5];
for (let a in itemList) {
console.log(a)
}
res: 0,1,2,3,4