the difference between an index and a key in an object javascript code example Example: indexOf by object key var index = peoples.findIndex(p => p.attr1 == "john")