Skip to content

Instantly share code, notes, and snippets.

@hamiltondanielb
Created May 13, 2015 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamiltondanielb/756520dbebfb9d0d335f to your computer and use it in GitHub Desktop.
Save hamiltondanielb/756520dbebfb9d0d335f to your computer and use it in GitHub Desktop.
ES6 array.find transpiled to ES5
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