More clean-up to array.js.

This commit is contained in:
Tobie Langel 2008-09-28 19:14:17 +02:00
parent f46a3c2430
commit f5d8a093f2
1 changed files with 4 additions and 3 deletions

View File

@ -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;
@ -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,