Add typeof to check if console is available