Add typeof to check if console is available

Without a ```typeof``` check, IE8 raise an JavaScript error with message _"console is undefined"_.