How do I print debug messages in the Google Chrome JavaScript Console?

Tamas Czinege picture Tamas Czinege · Oct 20, 2008 · Viewed 428.9k times · Source

How do I print debug messages in the Google Chrome JavaScript Console?

Please note that the JavaScript Console is not the same as the JavaScript Debugger; they have different syntaxes AFAIK, so the print command in JavaScript Debugger will not work here. In the JavaScript Console, print() will send the parameter to the printer.

Answer

Sergey Ilinsky picture Sergey Ilinsky · Oct 20, 2008

Executing following code from the browser address bar:

javascript: console.log(2);

successfully prints message to the "JavaScript Console" in Google Chrome.