How to log the errors in the console

console.error(” Errors”)

The above line of code can be used to log the errors.

This can be viewed after the complete code/program execution as shown below

Line of code in JavaScript
“Errors” printed out in the console window.