如何递归探索铬控制台数组 [英] How to recursively explore an array in the chrome console
问题描述
我想找到一种方法,探索在铬控制台Array对象的(甚至其他控制台一样的萤火虫的),因为我们可以很容易地为其他对象做。
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.
下面是我在Chrome控制台中输入的代码片段:
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, {}];
和结果在Chrome控制台:结果
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?
推荐答案
这是什么 console.dir()
功能是专为:
更多信息请参见:
https://developer.mozilla.org/en-US/文档/ DOM / console.dir
https://developers.google.com/chrome-developer-tools/文档/控制台
这篇关于如何递归探索铬控制台数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!