The following example displays the default message:
This example shows a red error message:
This gives a warning message with the exclamation mark in front of it:
This example outputs an information message with an 'i' letter in front of the message:
You can use the console.error method to print error. Here "x" is the variable's name:
The console.error outputs an error message to the Web Console. The console.exception() method is the alias for console.error(). Functionally, they do the same thing.