I am new to the web development world and I would like I am lost in the steps of creating an exception in a java script function
what I want to ideally do is something following the following syntax ...
function exceptionhandler (){
if (x===5)
{
//throw an exception
}
}
I found the following tutorial http://www.sitepoint.com/exceptional-exception-handling-in-javascript/ But I don t know how to convert the above if statement into a try..catch...finally exception
thanks!
try..catch
, but for throwing an exception. Could you elaborate a little?try..catch
will catch an exception if it already occurred. A check for equality likeif(x===5)
will never throw an exception.orly === false
-ReferenceError: orly is not defined