Console Logging
This example shows how to write things to the JavaScript Console.
That can be a useful tactic for detecting when events occur (as opposed to giving an alert window, for example).
The built-in console.log() function writes a string to the Console.
console.log("Hello World!");
Recall the instructions from a previous lesson on how to open the JavaScript Console in Chrome.
Every browser has a Console, so if you are using a browser other than Chrome,
you will need to search for information on how to open it.
Chrome Browser:
View → Developer → JavaScript Console
There are shortcut keys to make it easier to open the Console in Chrome.
Mac: Cmd + Option + J
Windows: Ctrl + Shift + J
Once you have it open, you can use the following links rigged with custom onclick event handlers to manipulate the Console.
They will still work with the console closed, you just won't be able to see the result of the events.
Click to call the console.log() function
Click to call the console.error() function
Click to call the console.clear() function