This actually isn't the best snippet. See the answers below by T. J. Crowder and canon for better console simulations.
There is an important difference though. Mine is a userscript which applies to all posts. The others are for including in a specific snippet, for everyone to benefit from.
I've created a script to do this. You can read more about it here on Stack Apps. Download it from Greasy Fork.
See it in action! (Image from this post)
Update (2014-10-12):
Now shows errors.