在Google Chrome控制台中查看所有JavaScript变量的列表 [英] View list of all JavaScript variables in Google Chrome Console
问题描述
有没有办法 - 或者至少有一个命令 - 用于Chrome控制台显示一个列表中的所有公共变量和对象?这将节省大量的输入。
这是您要查找的输出类型吗?
for(var b in window){
if(window.hasOwnProperty(b))console.log(b);
$ / code>
这将列出窗口 code> object(所有的函数和变量,例如
$
和 jQuery
)等。虽然,这是一个列表,不知道这是多么有用......
否则只要做窗口
和开始下去它的树:
窗口
这会给你 DOMWindow
,一个可展开/可探测的对象。
In Firebug, the DOM tab shows a list of all your public variables and objects. In Chrome's console you have to type the name of the public variable or object you want to explore.
Is there a way - or at least a command - for Chrome's console to display a list all the public variables and objects? It will save a lot of typing.
Is this the kind of output you're looking for?
for(var b in window) {
if(window.hasOwnProperty(b)) console.log(b);
}
This will list everything available on the window
object (all the functions and variables, e.g. $
and jQuery
on this page, etc). Though, this is quite a list, not sure how helpful it is...
Otherwise just do window
and start going down it's tree:
window
This will give you DOMWindow
, an expandable/explorable object.
这篇关于在Google Chrome控制台中查看所有JavaScript变量的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!