Javascript Array each(fun)
Array.prototype.each = function(fun) { for (var i = 0; i < this.length; i++) { fun(this[i]);/* ww w. jav a 2 s . c o m*/ } };