find the array index of an object with a specific key value javascript code example Example: indexOf by object key var index = peoples.findIndex(p => p.attr1 == "john")