how to get index from object.value in javascript code example
Example 1: get the index of object in array
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');