1try {
2 nonExistentFunction();
3} catch (error) {
4 console.error(error);
5 // expected output: ReferenceError: nonExistentFunction is not defined
6 // Note - error messages will vary depending on browser
7}
1var someNumber = 1;
2try {
3 someNumber.replace("-",""); //You can't replace a int
4} catch(err) {
5 console.log(err);
6}