JavaScript: Retrieve key names from an object?

Viewed 5953

Say I have this:

var x = {  
          a:{a1:"z", a2:"x"},
          b:{b1:"y", b2:"w"}
}

Is there a way to iterate over x to get "a" and "b"?

I want the member name, not its content (I don't want to get {a1:"z", a2:"x"}).

Thanks

1 Answers
Related