The Easiest Way To Access An Object's Single Own Property?
I have an object which will only have one property (own property). What is the easiest way to access that property's value? Something like: value = obj[]; I
Solution 1:
something like
var value = obj[ Object.keys(obj)[0] ];
getting the keys with Object.keys
and the first (and only) key with [0]
Post a Comment for "The Easiest Way To Access An Object's Single Own Property?"