function forEach(list, callback){
        for(var n = 0; n <list.length; n++){
            callback.call(list[n], n);
        }
    }
    var arr = [1,2,3,4,5,6,7,8]
    forEach(arr, function(index){
        if(this == arr[index]){
            console.log("Got the expected value of " + arr[index]);
        }
    })

  分享一个代码片段

相关文章:

  • 2021-05-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2021-11-07
  • 2022-02-03
  • 2022-02-27
猜你喜欢
  • 2022-12-23
  • 2021-06-26
  • 2021-07-22
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案