js how to fail a try{} code example
Example 1: try catch javascript
try {
// code may cause error
} catch(error){
// code to handle error
}
Example 2: try catch error
try {
console.log('hello');
}
catch (e){
}
try {
// code may cause error
} catch(error){
// code to handle error
}
try {
console.log('hello');
}
catch (e){
}