Handling Try Catch and Finally

Posted by Rajesh_Kumar under JavaScript category on | Points: 40 | Views : 920
function try_catch_finally
alert('function exists')
alert('An error has ocurred: '+ex.message);
alert('finally block will be called always');

In above function i have called call_js_function().
But this function does not exist anywhere in the code or page.
When above function will be called then exception will be raised as

An error has ocurred: call_js_function is not defined

Then after finally block will be called and alert message will be shown as

finally block will be called always

So,this way we can handle try catch and finally in Javascript

Comments or Responses

Login to post response