Your code may contain syntax errors and logic errors. Without debugging tools, these errors are more difficult to find.
Looking for errors in the program code is called code debugging.
Debugging is difficult, but fortunately, many browsers have built-in debugging tools.
The built-in debugging tool can be started or closed, and serious error messages will be sent to the user.
With debugging tools, we can set breakpoints (where the code stops executing), and can detect variables while the code is executing.
The browser to enable the debugging tool is generally to press the F12 key and select "Console" in the debugging menu.
a = 5;
b = 6;
c = a + b;
After checking, you can re-execute the code (such as the play button).
This keyword has the same effect as setting a breakpoint in the debugging tool.
If no debugging is available, the debugger statement will not work.
Open the debugger, the code stops execution before the third line.
var x = 15 * 5;
document.getElementbyId("demo").innerHTML = x;
Debugging Tools for Major Browsers
Usually, the browser to enable the debugging tool is generally to press the F12 key and select "Console" in the debugging menu.
The steps for each browser are as follows:
Or you can right-click the mouse and select "Inspect" , as shown in the figure below:
Microsoft Edge Browser
Or, you can do the simpler way is: right click the mouse and select "Inspect"