How to get error message in JavaScript?
In JavaScript error message property is used to set or return the error message. Return Value: It returns a string, representing the details of the error. More example codes for the above property are as follows: Example 1: This example does not contains any error so it does not display error message.
How to print error message in JavaScript?
You can use the console object to output a message to the error console. // Press F12 on your keyboard to view the message in the console view. let message = ["It's a warning message"