Created
August 24, 2011 00:01
-
-
Save vinniefranco/1166957 to your computer and use it in GitHub Desktop.
This file contains 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 characters
if (Array.prototype.map === undefined) { | |
Array.prototype.map = function(callback) { | |
var len = this.length; | |
if (typeof callback != "function") { | |
throw new TypeError(); | |
} | |
var mapped = [len], | |
o = arguments[1]; | |
for (var i = 0; i < len; i++) { | |
if (i in this) { | |
mapped[i] = callback.call(o, this[i], i, this); | |
} | |
} | |
return mapped; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment