Note: I’m going to use a specific object as an example here, but please don’t post answers specific to this example; the question is more general.
Specific example
I wrote some jQuery code like this...
$('#some_button').click(function(event) {
    $.post('<some URL>', { <some parameters> },
        function() { <do something on success> })
        .error(function(x) {
            // What is x?
        });
    event.preventDefault();
});
Now, for the purpose of this question, let’s assume that there is no documentation about that object x that is passed in.
An obvious thing to do might be
alert(x);
but all that will output is [object Object].
General question
What might be an easy way to find out what properties/methods an unknown object has? I’m thinking something that I’d just write during the debugging phase, no production code of course.
You may assume that jQuery is available.
Edit:
I’m fully aware of for (...), but surely that doesn’t mean there can’t be a better/easier way — I thought jQuery might have something built-in...
 
     
     
     
     
     
     
    