Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"throw" a warning in JavaScript?

In FireFox, there is this cute little Error-Console [Ctrl+Shift+J] where I can add an error by throwing it from JavaScript. Is there a way to display a warning or a message, too? I dont mean console.warn(), i really want it in the error-console, i'd just prefer to have it a warning mark instead of an error marking.

Is there a way to accomplish this?

like image 558
rhavin Avatar asked Jan 27 '26 04:01

rhavin


1 Answers

There is no such thing as a Warning in JavaScript. All errors are fatal.

console.warn will, in browsers that implement it, print a warning-level message in the console (similar to malformed HTML or security warnings).

Personally, I'd just write console.log("Warning: It's late and I'm drunk.");

like image 132
Niet the Dark Absol Avatar answered Jan 29 '26 17:01

Niet the Dark Absol



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!