так ладно пошел удалять свой маразм=)
<!DOCTYPE HTML>
<html>
<head> </head>
<body>
<script>
Array.prototype.each = function (fnc) {
var leng = this.length;
for(var i = 0;i< leng;i++) {
fnc.call(this[i]);
}
};
var arr = [];
for(var i = 0; i< 200;i++){
arr.push(i);
}
function speed(fnc) {
var d = new Date();
for(var i = 0;i< 10000;i++)fnc();
return new Date() -d ;
}
function myEach() {
var sum = 0;
arr.each(function(){
sum+=this;
});
}
function es5() {
var sum = 0;
arr.forEach(function(num){
sum +=num;
});
}
alert("My "+ speed(myEach));
alert("es5 "+ speed(es5));
</script>
</body>
</html>