for...in 、for…of 、forEach 、every 和 some 循环

let list = [4, 5, 6];
for (let i in list) {
    console.log(i+'-'+list[i]); // "0", "1", "2",
}

for (let i of list) {
    console.log(i); // "4", "5", "6"
}
console.log('------------');
let numbers = [1, 2, 3];
for (let num of numbers) {
    console.log(num);
}
console.log('------------');
let list1 = [44, 555, 6666];
list1.forEach((val, idx, array) => {
    console.log(val);// val: 当前值
    console.log(idx);// idx:当前index
    console.log(array);// array: Array
});

结果:

0-4
1-5
2-6
4
5
6
------------
1
2
3
------------
44
0
[ 44, 555, 6666 ]
555
1
[ 44, 555, 6666 ]
6666
2
[ 44, 555, 6666 ]