function try_catch_finally
{
try
{
call_js_function();
alert('function exists')
}
catch(ex)
{
alert('An error has ocurred: '+ex.message);
}
finally
{
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