Hide errors and warnings from console

后端 未结 7 1052
梦如初夏
梦如初夏 2021-01-01 23:11

In PHP and other languages there are ways to suppress error/warning messages.

Is there a way in javascript or jquery to prevent errors and warnings from being writte

7条回答
  •  醉酒成梦
    2021-01-01 23:24

    A dirty way to hide all Javascript console warnings is by overriding the console object's warn method:

    console.warn = () => {};
    

    Obviously, it also works with other console methods

提交回复
热议问题