findindex of element in array javascript 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 in list
let myList = ['foo', 'bar', 'qux'];
myList.indexOf('bar'); // 1
Example 3: .findIndex(
array.findIndex(call back function)
//index of ............
//first