Create try catch throw

This commit is contained in:
LSvekis 2021-09-06 13:14:24 -04:00 committed by GitHub
parent 4c1842233d
commit 2e01f4e724
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -0,0 +1,15 @@
function test(val) {
try {
if (isNaN(val)) {
throw "Not a number";
} else {
console.log("Got number");
}
} catch (e) {
console.error(e);
} finally {
console.log("Done " + val);
}
}
test("a");
test(100);