相当于Python的dir在Javascript中 [英] Equivalent of Python's dir in Javascript
问题描述
当我从解释器编写Python代码时,我可以键入 dir()
以具有在当前作用域中定义的名称列表。当我使用交互式控制台(如firebug,chrome console等)从浏览器开发Javascript代码时,如何实现相同的信息?
when I write Python code from the interpreter I can type dir()
to have a list of names defined in the current scope. How can achieve to have the same information, programmatically, when I develop Javascript code from a browser using an interactive console like firebug, chrome console, etc?
推荐答案
在ChatZilla的代码中有一些功能只能在这个代码中,你必须正确地检查许可证,看看你是否可以将它们解压出来,然后使用它们。
There are a couple of functions which do just this in the code for ChatZilla, you'll have to check the licence properly to see if you can just rip them out and use them wherever.
相关功能可以在
http://hg.mozilla.org/chatzilla/file/59b46c0bf716/js/lib/utils.js#l136
dumpObject
和 dumpObjectTree
这篇关于相当于Python的dir在Javascript中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!