Answers for "how to access the first property of an object"

0

get first property from object javascript

obj = { key:"value" }
Object.values(obj)[0] //returns "value"
Posted by: Guest on August-22-2021
0

select the first property in an object

let obj = {
first: 'first property value',
second: "hello"};
obj[Object.keys(obj)[0]]; //returns 'first property value'
Posted by: Guest on December-08-2021

Code answers related to "how to access the first property of an object"

Code answers related to "Javascript"

Browse Popular Code Answers by Language