Most of the web pages use Javascript either to validate the data or to implement AJAX functionality. As a web programmer, you would have probably used a Javascript construct alert(). Didn't you....!?

Javascript alert() is the most commonly used construct. This will display a small popup message on the webpage. Click here to see a sample popup message.

Although we use alert to display a message to user, we also use this to debug the Javascript. i.e.; when there is a problem, we used to print the values on the screen with alert message.

When I was working with Javascript earlier, I used to debug the Javascript with alert message. But sometimes when I had to debug the variable inside a loop, this alert message was annoying me.

I've finally got around with this problem. All we've to do is use console.log() construct. This will generate output onto the Javascript console. Every browser will have a Javascript console. Below the screenshot of a Javascript console on Firefox browser. Just hit a keyboard shortcut Shift+Ctrl+J to open the Javascript console on Firefox and Chrome.

Javascript console window on Firefox
Click here to generate a console message.