Possible Duplicate:
Access the first property of an object
I have a javascript object like this:
var list = {
item1: "a",
item2: "b",
item3: "c",
item4: "d"
};
Using reflection in JS, I can say list["item1"] to get or set each member programmatically, but I don't want to rely on the name of the member (object may be extended). So I want to get the first member of this object.
If I write the following code it returns undefined. Anybody knows how this can be done?
var first = list[0]; // this returns undefined