Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

access key of object javascript

var obj = { first: 'someVal', second: 'otherVal' };
alert(Object.keys(obj)[0]); // returns 'first'
alert(Object.keys(obj)[1]); // returns 'second'
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #access #key #object #javascript
ADD COMMENT
Topic
Name
6+2 =