Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

try catch throwing error in javascript

let json = '{ "age": 30 }'; // incomplete data

try {

  let user = JSON.parse(json); // <-- no errors
  alert( user.name ); // no name!

} catch (e) {
  alert( "doesn't execute" );
}
Source by www-db.deis.unibo.it #
 
PREVIOUS NEXT
Tagged: #catch #throwing #error #javascript
ADD COMMENT
Topic
Name
1+5 =