不支持foreach

2018-07-27  本文已影响0人  TRYao
if (typeof Array.prototype.forEach != 'function') {
    Array.prototype.forEach = function(callback){
      for (var i = 0; i < this.length; i++){
        callback.apply(this, [this[i], i, this]);
      }
    };
}
上一篇下一篇

猜你喜欢

热点阅读