How to check if 'debugger;' keyword exists?

后端 未结 4 1961
野趣味
野趣味 2021-02-08 11:06

Sometimes some developers forgot to remove debugger; in javascript code, and it produce javascript error on IE. How can you check (like for the console: if(wi

4条回答
  •  野趣味
    野趣味 (楼主)
    2021-02-08 11:54

    Haven't tried it for lack of an IE, but this should work:

    if (typeof console !== 'undefined') {
      console.log("logging enabled");    
    }
    

提交回复
热议问题