H5 es6 foreach使用

数组.foreach(数组中的每一项,下标)=>{}

例如:

let arr=[

{id:1,name:'张三'},

{id:2,name:'李四'},

{id:3,name:'王五'}

]

arr.foreach(item,index)=>{

  console.log(item.id)   //1,2,3

}

原文地址:https://www.cnblogs.com/mcll/p/11669604.html