Javascript Array forEach(callback, context)
Array.prototype.forEach = function (callback, context) { for (var index in this) { var item = this[index]; if (!callback(index, item, context)) { break;/*from w w w .jav a 2s. c o m*/ } } };