Debugging using Javascript
We need to the inspect eleemnt plug-in of the browser.
In the Inspect Element window, click on the "Console" tab
In most browsers, console is listed as a collection of prompts.
All Warnings and error messages are displayed with line numbewr and stack trace
These are listed in red colour.
Sometimes we may want to check if a variable has a particular value at a particular point in a program or to check if a varible is declared after it is used or if there is an infuinte recursion or an infinite while loop or for loop.
For this use the following code:
console.log("value of a in function test() is: " + a)
Comments
Post a Comment