📜  jjv - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:04:28.496000             🧑  作者: Mango

代码示例3
// 1: for

for (let i = 0; i < arr.length; ++i) {
  console.log(arr[i]);
}

// 2: forEach

arr.forEach((v, i) => console.log(v));

// 3: for in

for (let i in arr) {
  console.log(arr[i]);
}

// 4: for of

for (const v of arr) {
  console.log(v);
}