finding out if console is available

后端 未结 8 890
温柔的废话
温柔的废话 2020-12-23 20:00

I was wondering, how can i find out with javascript if the console object is available?

i have the problem that if i forget to remove a debug output

8条回答
  •  既然无缘
    2020-12-23 20:10

    Defined by firebug, IE8 (need to open the developer tools with F12), Chrome, etc but there is no defined spec for it. There is a console.log wrapper that makes it a very easy to use, cross browser logging solution so if the console doesn't exist your code doesn't explode.

提交回复
热议问题