If your browser supports it, you can also use the JSON.stringify()
function. It's best explained with an example:
var a = [
"123",
{ "foo": "bar" },
[ "inner", "array", [ "inner-inner", "array-array" ] ]
];
console.log( JSON.stringify(a) );
// "["123",{"foo":"bar"},["inner","array",["inner-inner","array-array"]]]"
Basically the function converts objects into a JSON string format allowing you to see each object/array and all of it's sub-elements in a plan, string-like format.
Keep in mind that this method will only be effective if the object you are trying to view only contains simple types of data... Function definitions within objects and more complex built-in objects such as window
or document
will not yield useful information.