Skip to content

matejthedev/debugging_chrome_devtools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Debugging with Chrome DevTools

The Chrome DevTools are a powerful tool that allows developers to diagnose and fix issues with their code. One of the most important features of the DevTools is the ability to use breakpoints, which let you pause the execution of your code so that you can inspect the state of your program at a specific moment in time.

Here's how to use breakpoints in the Chrome DevTools to find and fix a bug in this code:

  1. Open the page in Google Chrome and right-click anywhere on the page. Select "Inspect" from the context menu to open the DevTools.

  2. Click on the "Sources" tab to access the code editor.

  3. Find the file that contains the code you want to debug, and click on it to open it in the code editor. In this case, it's the script.js file.

  4. Find the line of code that you want to debug and click on the line number to the left of the code to set a breakpoint. For example, if you want to debug the calculateSum function, you could set a breakpoint on the first line of the function.

  5. Interact with the page to trigger the code that you want to debug. In this case, you can input some numbers and click the "Calculate" button.

  6. The code will pause at the breakpoint, and the DevTools will automatically switch to the "Sources" tab. You can inspect the state of your code by hovering over variables to see their values, or by opening the "Scope" section to see all of the variables in the current scope.

  7. To step through the code line by line, you can use the "Step Over" button, which is located in the DevTools toolbar and looks like a right arrow.

  8. If you find an issue with your code, you can make changes to it directly in the DevTools

About

Simple html and js snippet for practicing devtools

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published