get first object key js code example
Example 1: js get first object value
var obj = { first: 'someVal' };
obj[Object.keys(obj)[0]]; //returns 'someVal'
Example 2: get first object key javascript
var example = {
foo1: { /* stuff1 */},
foo2: { /* stuff2 */},
foo3: { /* stuff3 */}
};
let [first] = Object.keys(example)
console.log(first)