how to get the index of an object in an array javascript button code example Example: indexOf by object key var index = peoples.findIndex(p => p.attr1 == "john")