1throw new Error("Error message here"); // Uncaught Error: Error message here
1let json = '{ "age": 30 }'; // incomplete data
2
3try {
4
5 let user = JSON.parse(json); // <-- no errors
6 alert( user.name ); // no name!
7
8} catch (e) {
9 alert( "doesn't execute" );
10}