var obj = { "a" : 1, "b" : 2, "c" : 3};
alert(Object.keys(obj)[0]);
// alerts "a"
let objLength = Object.keys(obj).length
console.log(objLength)
// Logs 3 as "obj" has 3 keys
var objValue = Object.values(obj)[0]
console.log(objValue)
// Logs "1" as the value of the first key(a) is "1"
var obj = { first: 'someVal' };
obj[Object.keys(obj)[0]]; //returns 'someVal'
var person = {"name":"Steve","age":43};
var firstKeyValue = person[Object.keys(person)[0]]; //"Steve"
var example = {
foo1: { /* stuff1 */},
foo2: { /* stuff2 */},
foo3: { /* stuff3 */}
};
let [first] = Object.keys(example)
console.log(first)