try and except catch error code example
Example 1: try catch error
try {
console.log('hello');
}
catch (e){
}
Example 2: try catch exception
First try block try to handle it
if not then catch block will handle it.
Finally block will executed regardless
of the outcome