Manyahin,
Array.prototype.each = function(fn) {
for (var i=0; i<this.length; i++) {this[i] = fn.call(this, this[i], i);}
return this
}
alert([1,2,3].each(function (a)
{
return a*a
}));
['test',false,12].each( function(el, i) {
alert([el,i]);
return el
})