find index of object code example
Example 1: find index of object in array javascript
a = [
{prop1:"abc",prop2:"qwe"},
{prop1:"bnmb",prop2:"yutu"},
{prop1:"zxvz",prop2:"qwrq"}];
index = a.findIndex(x => x.prop2 ==="yutu");
console.log(index);
Example 2: js find index of object by value of property and return it's key
const index = Data.findIndex(item => item.name === 'John');