how to display error message in javascript 1

how to display error message in javascript

//to display error message just put this code at the end of your brackets
.catch((err) =>{
    console.log(err);

Here is what the above code is Doing:
1. We’re using the .catch() method to catch any errors that may occur.
2. We’re passing in a callback function that takes in an error parameter.
3. We’re using the console.log() method to log the error to the console.

Similar Posts