Console is Undefined in IE8

If you’ve ever developed using Javascript, you should know that console.log is probably your most important tool. Unfortunately, not all web browsers support it (e.g. IE8 only supports it when Developer Tools is activated). Here’s a way of checking to see if console.log exists and if it does, go ahead and use it. If you wanted, you could also throw in an else and alert out your message, but you’d have to iterate through the arguments array and alert each element out ;-), which was something I wasn’t willing to do.

var log = function () {
  if(console) console.log(;