..


Sponsored Links

try ... catch

Try the command for error handling in JavaScript evaluates the statements to run.

Let's see an example of code:






 try







 {



  



 document.write ("Tthe my name is" + myname);







 }







 catch (e)







 {



  



 document.write ("The variable 'myname' is not defined!");







 }



If the instructions that follow try to generate an error code prints the error message below to catch (e).

The paramaetro "and" (conventional) means exeption (or exception) that may be associated with the owners of the error values, for example:





 try







 {



  



 document.write ("Tthe my name is" + myname);







 }







 catch (e)







 {



  



 document.write (e.Message);







 }



In the same category ...
E-Learning
CSS (Course) CSS (Course)
Web Design and Accessibility according to W3C CSS and XHTML. Starting from 29 €.
HTML (Course) HTML (Course)
The markup language for the Web from 29 €.
Javascript (Course) Javascript (Course)
Complete guide to client-side scripting. From 39 €.
Sponsored Links