Created
May 13, 2015 18:24
-
-
Save hamiltondanielb/756520dbebfb9d0d335f to your computer and use it in GitHub Desktop.
ES6 array.find transpiled to ES5
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 characters
Array.prototype.find = Array.prototype.find || function(predicate, thisArg) { | |
for (var i = 0; i < this.length; ++i) { | |
if (predicate.call(thisArg, this[i], i, this) === true) { | |
return this[i]; | |
} | |
} | |
return undefined; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment