Array.prototype.forEach = function (callback, context) { for (var i = 0; i < this.length; i++) { callback.call(context || null, this[i], i, this); } } var arr = ["a", "b","c"]; arr.forEachs(function (value, index, array) { debugger; });