Skip to content

Commit

Permalink
More clean-up to array.js.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobie committed Sep 28, 2008
1 parent f46a3c2 commit f5d8a09
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/array.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ Array.from = $A;

(function() {
var arrayProto = Array.prototype,
slice = arrayProto.slice;
slice = arrayProto.slice,
_each = arrayProto.forEach; // use native browser JS 1.6 implementation if available

function each(iterator) {
for (var i = 0, length = this.length; i < length; i++)
iterator(this[i]);
}

if (!_each) _each = each;

function clear() {
this.length = 0;
return this;
Expand Down Expand Up @@ -150,7 +152,6 @@ Array.from = $A;
if (!arrayProto._reverse)
arrayProto._reverse = arrayProto.reverse;

var _each = 'forEach' in arrayProto ? arrayProto.forEach : each;
Object.extend(arrayProto, {
_each: _each,
clear: clear,
Expand Down

0 comments on commit f5d8a09

Please sign in to comment.