I see too many people use
alert() when smoke testing a web application when they should be using
Why should you prefer
console.log() over the unmistakably obvious
alert() in testing, and removing the call later on.
console.log() outputs to the consoles of many of the popular browsers, especially Chrome & Firefox. (Tip: press CTRL+SHIFT+J in Chrome or use Firebug’s console in Firefox).
The only gotchya when it comes to console.log if you’re not curently running the console,
window has no property
This will use a console if available, if not it will do nothing(more importantly, no errors).