Javascript Array forEach(funct)
Array.prototype.forEach = function(funct){ var last_num; for(var i=0;i<this.length;i++){ /* w ww . j a va2 s . c o m*/ last_num = funct(this[i]); } return last_num; };