Skip to content

Instantly share code, notes, and snippets.

@rkaw92
Created July 15, 2020 14:33
Show Gist options
  • Save rkaw92/0f5144d24dc0bbde702e80d0f98a9ca0 to your computer and use it in GitHub Desktop.
Save rkaw92/0f5144d24dc0bbde702e80d0f98a9ca0 to your computer and use it in GitHub Desktop.
You understand JS exceptions... or do you?
function try1() {
try {
return 1;
} catch (error) {
} finally {
console.log('try1(): in finally{}');
}
}
function try2() {
try {
return 1;
} catch (error) {
} finally {
console.log('try2(): in finally{}');
return 2;
}
}
console.log('try1():', try1());
console.log('try2():', try2());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment