Created
December 19, 2012 10:01
Revisions
-
EarMaster created this gist
Dec 19, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ /** * Polyfill for forEach array iteration function * * @see https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach */ if (!Array.prototype.forEach) { Array.prototype.forEach = function forEach(callback, thisArg) { var T, k; if (this==null) throw new TypeError( "this is null or not defined" ); var O = Object(this); var len = O.length >>> 0; if ({}.toString.call(callback)!=="[object Function]") throw new TypeError( callback + " is not a function" ); if (thisArg) T = thisArg; k = 0; while(k<len) { var kValue; if (Object.prototype.hasOwnProperty.call(O, k)) { kValue = O[k]; callback.call( T, kValue, k, O ); } k++; } }; }