tags:

views:

45

answers:

3

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?

+1  A: 

firebug allows you to watch variables.

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

hvgotcodes
+2  A: 

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.

Alex Mcp
I don't get break points, are they just places to stop the script?
Mild Fuzz
Break points are places to stop the script, and then you can step through the following lines of script one line at a time. Break points are very useful for debugging.
smfoote
+1  A: 

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

smfoote