Skip to content

Instantly share code, notes, and snippets.

@MarkAdell
Created July 20, 2023 22:17
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 MarkAdell/05afa2f6f873694c21eff85f49a9552d to your computer and use it in GitHub Desktop.
Save MarkAdell/05afa2f6f873694c21eff85f49a9552d to your computer and use it in GitHub Desktop.
Functional programming article exercise solution
function findLast(array, predicate) {
for (let i = array.length - 1; i >= 0; i--) {
if (predicate(array[i])) {
return array[i];
}
}
return undefined;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment