From the course: Learning JavaScript Debugging
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Monitor variables with watches - JavaScript Tutorial
From the course: Learning JavaScript Debugging
Monitor variables with watches
- [Narrator] In this video, we're going to talk about watches which are a way to monitor variable values and expression values over time. So here in this example file, here's my custom JavaScript at the bottom of the index.html. And I have some new functions here, some new data. So let's set a breakpoint here on line 325 for actionTime. And I'll refresh the page. So I've stopped at this point where this variable is going to be assigned. Now of course, when you wanna find what any particular variable is assigned to, you can look through the call stack. But depending on how deeply you have to go in here to find a particular piece, how many closures you have to go through, which part of the scope you wanna get into. Or how deep the data structure of your objects might go. It can be a little bit of a pain to have to hit all these triangles and go find the right thing. That's where watch expressions come in. So here in the watch expressions inspector, I can hit the plus sign to add a new…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Debugging without a debugger5m 16s
-
Leverage more of the Console API7m 4s
-
Stop and look around: Simple breakpoints5m 24s
-
Explore other breakpoint options7m 47s
-
Challenge: Knowing when to stop2m 28s
-
Solution: Knowing when to stop3m 56s
-
Step into, over, and out of functions5m 48s
-
Find out where you are using the call stack4m 34s
-
Monitor variables with watches5m 16s
-
Source maps to debug minified files4m 41s
-
Challenge: Putting it all together4m 10s
-
Solution: Putting it all together8m 52s
-
-
-