Hide errors and warnings from console

后端 未结 7 1033
梦如初夏
梦如初夏 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:28

    You can handle errors to some extent but if error is not handled by you then it goes to browser and you can not stop browser showing it. You can write code in such a way that you get minimum error and using try-catch where possible to handle the exceptions.

    try
    {
        //statements suspected to throw exception.
    }
    catch(e)
    {
    }
    

提交回复
热议问题