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

Mark Harrison picture Mark Harrison · Oct 2, 2008 · Viewed 889k times · Source

How can I print a message to the error console, preferably including a variable?

For example, something like:

print('x=%d', x);

Answer

Dan picture Dan · Oct 2, 2008

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