+ 19

Is there any way to supress console warnigns ??

I've often seen WEB codes which are good but a warning from bottom pops up.... and it really destroys the beauty of the code. So, is there any way to suppress console warnings ??

16th Aug 2020, 2:20 AM
Locus
Locus - avatar
7 ответов
+ 7
I tried using Try catch statements and it worked out in suppressing console warnings :)
18th Nov 2020, 1:01 AM
Locus
Locus - avatar
+ 9
But what if a warning is being generated by an external API. and that cannot be fixed. Then in that case, I'm asking if there is any way to suppress them.
16th Aug 2020, 3:49 AM
Locus
Locus - avatar
+ 9
Add console.log = function () {}
16th Aug 2020, 4:18 AM
Calviղ
Calviղ - avatar
+ 8
Calviղ That doesn't works if you are using an external API or iframe like external thing.
16th Aug 2020, 4:24 AM
Locus
Locus - avatar
+ 4
Console.log(yourfunction)
22nd Oct 2020, 1:55 AM
Massan
Massan - avatar
+ 2
Ignoring warnings isn't a good idea, if it is possible to do that, then we'd be encouraged to ignore a warning which could possibly turn into an error being left off piling up : )
16th Aug 2020, 3:43 AM
Ipang
0
I agree with Ipang . Suppressing warnings is usually not a good idea, since it leads to obscure errors later on. It is wise to throw errors and fix them as soon as possible. Short-term pain for long-term gain. This is based on teachings from the book "Effective Java" by Joshua Bloch.
23rd Dec 2020, 11:29 PM
Chris Ng
Chris Ng - avatar