0

I would like to watch for any variables that change on a webpage using chrome or firefox (or any browser). Is there an extension or method to do that?

E.g. If a webpage has a few hundred variables, I would like to know when x or any other variable changes in value.

hitwill
  • 575
  • 1
  • 9
  • 25

1 Answers1

0

I am not 100% sure this will make the code stop when the variable changes, but it's the closest thing I could find.

The Watch Expressions tab lets you monitor the values of variables over time. As the name implies, Watch Expressions aren't just limited to variables. You can store any valid JavaScript expression in a Watch Expression. Try it now:

  • Click the Watch tab.
  • Click Add Expression Add Expression.
  • Type typeof sum.

    Press Enter. DevTools shows typeof sum: "string". The value to the right of the colon is the result of your Watch Expression.

enter image description here

Source: https://developers.google.com/web/tools/chrome-devtools/javascript/#watch-expressions

This stackoverflow question is also worth reading: Chrome JavaScript Debugging: how to break when a value changes

Also: Break on a change of variable value

Jacob Sánchez
  • 390
  • 3
  • 15