We can easily track our code in Java Script by writing text messages to the Java Script console. The following code sample shows how to do it.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title></title> <script type="text/javascript"> var sum = 0; for(i=1; i<=10; i++) { sum+=i; console.log("i="+i); console.log("sum="+sum); } document.write("sum="+sum); </script> </head> <body> </body> </html>
The following video clip explains the code sample When using Firefox there is a need in installing the Firebug extension.