Possible Duplicate:
Access the first property of an object
I just want to know if there is a better way to get the first member name in a object like:
var x={a:1};
func(x);//will return 'a'
I programmed a small function but I'm not satisfied, i think that there is a better way
what i did is :
var get_member = function(obj){for (i in obj){if (obj.hasOwnProperty(i)) return i;}};