May 28, 2021 Article blog
This article w3cschool is a compilation to show you how JavaScript can be debugged.
JavaScript debugs in two ways:
console.log()
and
debugger
The following classification shows how the two methods are debugged.
Open the web page you want to debug with your browser, press
F12
or check the
检查元素
view the source code, select
console
and you can debug.
As shown in the following image.
The debugger keyword is used to stop javaScript execution and call debug functions, much like setting a breakpoint effect in a debugging tool. W hen we turn on the debugger, the code stops executing before the third line. W ithout debugging, the debugger statement will not work. Here are some examples:
var x = 15 * 5;
debugger;
document.getElementbyId("demo").innerHTML = x;
That's all JavaScript does to debug. For more JavaScript learning, follow w3cschool.com.