As I said in another thread, always use console.log('message') and not alert('message').
Then for production you can always do this at the top of your main JavaScript include:
var console = {};
console.log = function(){};