Userscripts are helper Javascript programs that you can add to your browser to automate and optimize the web pages you visit. Greasemonkey is a Firefox extension to run userscripts. The web console is a tool built into Firefox and other browsers that can be helpful during userscript development.
How can you access the web console from Greasemonkey userscripts? First of all, you should not do this in production. However, logging to the web console can be a useful tool during development.
Here’s how you do it:
// Put this at the top of your userscript var console = unsafeWindow.console;
Bonus: How to access your userscript’s jQuery from the web console
// Expose userscript's jquery to the web console unsafeWindow.$ = $;
Again, do not do this in production.