Error handling in JavaScript using try catch method

Every programme goes off for error . when we write hundreads line of code but one error occur in the code then the rest of the code is not exucated. To avoid this occur we use try catch method . So at first we should know what is error.

Error

Error Handling

Try…Catch

Fig : 1

In the figure we can see the programme can not execute because we here c is not defined . To avoid this we can use try catch method.

In the above figure use try catch method . Here c is not defined , but the programme is executed. Because when we use try method the programme is executed if any error cause of in programme . If any error cause of in programme then it show message.