JavaScript: How do I print a message to the error console?

Solution 1:

Install Firebug and then you can use console.log(...) and console.debug(...), etc. (see the documentation for more).

Solution 2:

console.error(message); // Outputs an error message to the Web Console
console.log(message); // Outputs a message to the Web Console
console.warn(message); // Outputs a warning message to the Web Console
console.info(message); // Outputs an informational message to the Web Console. In some browsers it shows a small "i" in front of the message.

You also can add CSS:

console.log('%c My message here', "background: blue; color: white; padding-left:10px;");

More info can be found here: https://developer.mozilla.org/en-US/docs/Web/API/console