get first value in object javascript code example
Example 1: js get first object value
var obj = { first: 'someVal' };
obj[Object.keys(obj)[0]];
Example 2: javascript object first key
var person = {"name":"Steve","age":43};
var firstKeyValue = person[Object.keys(person)[0]];
Example 3: get first object key javascript
var example = {
foo1: { },
foo2: { },
foo3: { }
};
let [first] = Object.keys(example)
console.log(first)
Example 4: javascript get first property of object
var person = { 'first_name': 'Johny', 'last_name':'Carson' };
var firstName=person[Object.keys(person)[0]];