最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

is there an easy way to track a javascript variable with firefox? - Stack Overflow

programmeradmin0浏览0评论

I am looking for an easy way to track the many changed of a variable in firefox.

I am looking for something that will not require me to add reduntant code, like alert, or console.log, but rather way to tell firefox to report each time a JS var is changed

am I dreaming?

I am looking for an easy way to track the many changed of a variable in firefox.

I am looking for something that will not require me to add reduntant code, like alert, or console.log, but rather way to tell firefox to report each time a JS var is changed

am I dreaming?

Share Improve this question asked Oct 20, 2010 at 19:00 Mild FuzzMild Fuzz 30.9k34 gold badges105 silver badges152 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 3

firebug allows you to watch variables.

http://getfirebug./wiki/index.php/Script_Panel

You can add it to the "Watch" tab under the "Script" tab in Firebug. This will always show you the current value of a watched item, even if it's out of scope and null. Mix that in with break points and you can get what you want I think.

Additionally, console.log isn't redundant. You could set a global variable that would turn on the logs, something like:

if (debugging) {
    console.log("var test is set at " + test);
}

That way they'd act more like trace points that you could trigger. For a bigger app this overhead pays for itself quite quickly.

It sounds like you are looking for Firebug. Check it out.

发布评论

评论列表(0)

  1. 暂无评论