Given an object like this:
{ name: "joe" }
I want to get the value "name". I know I can use the for construct to iterate over the properties in an object, but the objects I'll be dealing with will always have a single key:value pair, and I won't know the name of the property. To further illustrate:
var a = { age: 24 };
console.log(myFunc(a)) // Displays "age"
var b = { job: "cook" };
console.log(myFunc(b)) // Displays "job"
Is there anyway to do this without iterating over the object? Also I'd like to do this in pure Javascript. No frameworks/libs involved.