Skip to content

Instantly share code, notes, and snippets.

@vcostin
Last active November 21, 2016 13:08
Show Gist options
  • Save vcostin/ce4608c5de03bf12e618218487c2b916 to your computer and use it in GitHub Desktop.
Save vcostin/ce4608c5de03bf12e618218487c2b916 to your computer and use it in GitHub Desktop.
arrayIndexSearch
var getIndex = function(arr, verify) {
for (var i = 0; i < arr.length; i++) {
if (verify(arr[i])) {
return i;
}
}
return -1;
};
//var index = getIndex(notesCache.items, function (element) {
// return element.id === data.id;
//});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment