Skip to content

Instantly share code, notes, and snippets.

@kmaida
Created October 19, 2017 19:53

Revisions

  1. Kim Maida created this gist Oct 19, 2017.
    8 changes: 8 additions & 0 deletions indexOfObjInArray.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    const indexOfObj = (array, key, value) => {
    for (let i = 0; i < array.length; i++) {
    if (array[i][key] === value) {
    return i;
    }
    }
    return -1;
    };