+ 2

How can I prevent the console from appearing when there are errors?

So, there is one error message that appears only once very rearly when I play a sound, it normally doesn't appear but some times it does, and it doesn't really effect my game since as I said it almost never happens, I'm not sure what causes the error but since it doesn't effect the game I didn't really care to further investigate anyway. The problem is that in SoloLearn the console will appear every time an error happens, I tried using try{}catch{} but the error still appears and I don't really want the console to hide the screen, any way to prevent the console from appearing?

27th Apr 2021, 11:42 AM
Karak10
Karak10 - avatar
1 Resposta
+ 4
https://stackoverflow.com/questions/52493168/how-to-remove-errors-warnings-from-console/52493264 [redefining the console] var noOp = function() {} window.console = { log: noOp, dir: noOp // all other methods... }; console.log('foo'); console.log(1/0); // division by 0
27th Apr 2021, 12:10 PM
minirkk
minirkk - avatar