module to print output from their code. When your code runs in a browser, the
console output is sent to the web inspector’s error console. Otherwise, if it’s
running in NodeJS then the console output is sent to stdout or stderr in your
Wouldn’t it be cool if you could rewire the console in CodePen to print messages to the result panel, instead of being hidden away in the web inspector? Behold the rewired console:
Now you can use the standard
console.error functions to print messages to the rewired console. You can
console.clear to clear all messages.
What if your pen produces so much output that the result panel overflows and
you can no longer see the messages as they are printed? The answer is the
If you enable following then the console will scroll to the bottom every time a message is printed. Here’s an example:
If you would like to use console rewiring in your next pen, then simply fork this pen to get started.