Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

access the first property of a javascript object

var obj = { first: 'someVal' };
obj[Object.keys(obj)[0]]; //returns 'someVal'

Object.values(obj)[0]; // returns 'someVal'
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #access #property #javascript #object
ADD COMMENT
Topic
Name
5+4 =