问题
I would like to find a way to explore Array objects in the chrome console (and even other console like firebug), as we can easily do for other objects.
Below is the snippet I entered in the chrome console :
var str = new String("foo"); str;
var bool = new Boolean(true); bool;
["foo", "bar", str, bool, {}];
And the results in the chrome console :

The only way I could find at the moment is kind of a hack :
[["foo", "bar", str, bool, {}]];

Is there any option, command or method to just show the inner structure of the array object as it is done by default for other objects?
回答1:
That is what the console.dir()
function was built for:

See for more information:
https://developer.mozilla.org/en-US/docs/DOM/console.dir
http://getfirebug.com/logging
https://developers.google.com/chrome-developer-tools/docs/console
回答2:
You can use both console.dir and console.log (depending on the current version):
var str = new String("foo"); str;
var bool = new Boolean(true); bool;
console.dir(["foo", "bar", str, bool, {}]);
console.log(["foo", "bar", str, bool, {}]);
回答3:
Use console.log(["foo", "bar", str, bool, {}]);
works both in the console and from a script:

来源:https://stackoverflow.com/questions/14537655/how-to-recursively-explore-an-array-in-the-chrome-console