for
1. for 循环
for 循环for (let i = 0; i < array.length; i++) {
// 操作 array[i]
}let arr = [10, 20, 30, 40];
for (let i = 0; i < arr.length; i++) {
console.log(arr[i]); // 输出: 10, 20, 30, 40
}2. for...of 循环
for...of 循环for (let element of array) {
// 操作 element
}3. for...in 循环
for...in 循环4. forEach() 方法
forEach() 方法Last updated