+ 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 ??
7 odpowiedzi
+ 7
I tried using Try catch statements and it worked out in suppressing console warnings :)
+ 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.
+ 9
Add
console.log = function () {}
+ 8
Calviղ That doesn't works if you are using an external API or iframe like external thing.
+ 4
Console.log(yourfunction)
+ 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 : )
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.