Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
JavaScript Array Map Function
Array.prototype.map = function (fn) {
var l = this.length;
var a = [];
for (var i = 0; i < l; i++) {
a.push(fn(this[i]));
}
return a;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.