Bad idea to leave “console.log()” calls in your production JavaScript code?

后端 未结 11 1979
醉话见心
醉话见心 2020-12-07 08:03

I have a bunch of console.log() calls in my JavaScript.

Should I comment them out before I deploy to production?

I\'d like to just leave them th

11条回答
  •  攒了一身酷
    2020-12-07 08:37

    A nice one-liner:

    (!console) ? console.log=function(){} : console.log('Logging is supported.');
    

提交回复
热议问题