Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

try catch javascript

try {

  alert('Start of try runs');  // (1) <--

  lalala; // error, variable is not defined!

  alert('End of try (never reached)');  // (2)

} catch(err) {

  alert(`Error has occurred!`); // (3) <--

}
Source by javascript.info #
 
PREVIOUS NEXT
Tagged: #catch #javascript
ADD COMMENT
Topic
Name
5+1 =