JSON object return values โโbased on position
3 answers
I guess you think about Object.keys()
or cyclefor..in
You cannot rely on your position, because depending on the browser implementation, the object keys are sorted in lexicographic order OR not, ecma5 does not enforce it anyway.
+5
source to share
Good answer here:
fooobar.com/questions/20793 / ...
var obj = { first: 'someVal' };
obj[Object.keys(obj)[0]]; //returns 'someVal'
+1
source to share