简体   繁体   English

如何使用firefox / firebug / chrome调试器获取局部变量数组?

[英]How to get local variables array with firefox/firebug/chrome debugger?

Does firefox/firebug/chrome debugger provides api for getting array of local variables in console? firefox / firebug / chrome调试器是否提供用于在控制台中获取局部变量数组的api? Or there is some software that provides api like that? 还是有一些提供api这样的软件?

Local variables, as in those scoped within a function? 局部变量,如函数范围内的变量?

No, you wouldnt be able to view those unless you expose them from within the function using this or prototype 不,除非您使用thisprototype从函数内部公开它们,否则您将无法查看它们

EDIT: More information 编辑:更多信息

function Car(color){ this.color = color; }
var myCar = new Car("red");
myCar.color // This would output red, and if myCar was globally defined you could view it.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM