let colors = ["red","yellow","blue"];
colors.forEach((color)=>{
    console.log(color);
    //red
    // yellow
    // blue
})

let numbers = [1,3,45,67];
numbers.forEach(function(item,index,arr){
    console.log(item);
    console.log(index);
    console.log(arr);
    // 1
    // 0
    // [1,3,45,67]
    // 3
    // 1
    // [1,3,45,67]
    // 45
    // 2
    // [1,3,45,67]
    // 67
    // 3
    // [1,3,45,67]
})

 

相关文章:

  • 2021-10-03
  • 2022-12-23
  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
  • 2021-07-25
  • 2021-06-03
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案