javascript object first key
snippet in javascript

javascript object first key

user3213

var person = {"name":"Steve","age":43};
var firstKeyValue = person[Object.keys(person)[0]]; //"Steve"

get first object key javascript

user383

var example = {
    foo1: { /* stuff1 */},
    foo2: { /* stuff2 */},
    foo3: { /* stuff3 */}
};

let [first] = Object.keys(example)

console.log(first)