For an object like this:
{ name: "joe" }
I want to get the value "name". I know that I can use the for construct to iterate over the properties of an object, but the objects that I will deal with will always have one key pair: the value, and I will not know the name of the property. To further illustrate:
var a = { age: 24 };
console.log(myFunc(a))
var b = { job: "cook" };
console.log(myFunc(b))
Is there a way to do this without iterating over an object? I would also like to do this in pure Javascript. No frameworks / libs.
source
share