Skip to content

Instantly share code, notes, and snippets.

@kironroy
Created June 17, 2023 22:40
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 kironroy/35ce6dce1f043facfd2eda939e956864 to your computer and use it in GitHub Desktop.
Save kironroy/35ce6dce1f043facfd2eda939e956864 to your computer and use it in GitHub Desktop.
find method
const movements2 = [200, 450, -400, 3000, -650, -130, 70, 1300];
const firstWithdrawal = movements2.find(mov => mov < 0);
console.log(movements2);
console.log(firstWithdrawal);
// array of objects is a common data structure
console.log(accounts);
const account = accounts.find(acc => acc.owner === 'Jessica Davis');
console.log(account);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment