JS中使用for-each遍历数组
1 let array = [1, 3, 6, 8, 9, 0, 5];
2 /*
3 index是数组索引
4 value代表数组的值
5 arr是指整个数组
6 */
7 array.forEach((value, index, arr) => {
8 console.log('数组=' + arr);
9 console.log('索引号=' + index, '值=' + value);
10 });

浙公网安备 33010602011771号