how to get index position of array of object using key in js code example Example: indexOf by object key var index = peoples.findIndex(p => p.attr1 == "john")