javascript
let each=function (array,callback){
for(let i=0,len=array.length;i<len;i++){
//回调函数
if(callback(i,array[i])===false){
break//停止代码
}
}
}
var names=[{
naem:"贾维斯",
id:1001,
age:50
},{
naem:"史塔克",
id:1002,
age:30
}]
each(names,function(index,value){
console.log(index,value)
})