+ -
当前位置:首页 → 问答吧 → 初学 prototype

初学 prototype

时间:2011-04-04

来源:互联网

Array.prototype.each = function(fn){
  fn = fn || Function.K;
  var a = [];
  var args = Array.prototype.slice.call(arguments, 1);//???????
  for(var i = 0; i < this.length; i++){
  var res = fn.apply(this,[this[i],i].concat(args)); //????????????
  if(res != null) a.push(res);
  }
  return a;
};

明白的大侠解释下,谢谢了!

作者: minjun0901   发布时间: 2011-04-04


看这里
看明白了在继续看prototype.js

作者: KK3K2005   发布时间: 2011-04-04