Skip to content

Instantly share code, notes, and snippets.

@andrewjmead
Created February 15, 2016 22:26
Show Gist options
  • Select an option

  • Save andrewjmead/bd58be5392ad118ade21 to your computer and use it in GitHub Desktop.

Select an option

Save andrewjmead/bd58be5392ad118ade21 to your computer and use it in GitHub Desktop.
John - getAccountIndex()
function getAccountIndex(acctNumber) {
for (var i = 0; i < accounts.length; i++) {
var account = accounts[i];
if (acctNumber === account.accountNumber) {
var index = accounts.indexOf(account);
console.log("Found it!");
console.log("Index: " + accounts.indexOf(account));
return index;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment