Site icon NgDeveloper

Console.log Example in Javascript

Hello Javascript programmers,
As we know debugging is very difficult in javascript since alert is the only option to check the code flow and functionalities.

But we can not proceed always with alert alone.

Console.log is like system.out in java, print in c and cout in c++, we can see console.log output in IE developer tools (by pressing f12). you can find the sample program below,

[html]
<html>
<head>
<title>
Console Log
</title>
<script type="text/javascript">
console.log ("Testing log");
console.log ("Now we can debug easily");
</script>
</head>
<body>
Checking log functionality </br>
Press F12 in IE </br>
Click Script tab in left top </br>
Now you can see Console in right side </br>
If you want to clear Right click and clear console.

</body>
</html>
[/html]

Output Screenshot:

 

 

Recommended Javascript Books:

Exit mobile version