indexof with objects code example
Example 1: using index of on array of objects
arr = [{x: "a", y: 1}, {x: "something", y: 2}]
arr.findIndex(obj => obj.x === "a" && obj.y === 1);
Example 2: indexof object javascript
var hello = {
hello: 'world',
foo: 'bar'
};
var qaz = {
hello: 'stevie',
foo: 'baz'
}
var myArray = [];
myArray.push(hello,qaz);
var indexOfStevie = myArray.findIndex(i => i.hello === "stevie");