catchs JS code example
Example 1: catch javascript
//Catch is the method used when your promise has been rejected.
//It is executed immediately after a promise's reject method is called.
//Here’s the syntax:
myPromise.catch(error => {
// do something with the error.
});
//error is the argument passed in to the reject method.
Example 2: blank catch js
try {
try_statements
}
[catch [(exception_var)] {
catch_statements
}]
[finally {
finally_statements
}]