Hide errors and warnings from console

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


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)
{
}