object index of key js code example
Example 1: javascript get first property of object
var person = { 'first_name': 'Johny', 'last_name':'Carson' };
var firstName=person[Object.keys(person)[0]]; //get first value of object :'Johny'
Example 2: indexOf by object key
var index = peoples.findIndex(p => p.attr1 == "john")