Last active
April 20, 2016 22:18
-
-
Save jkup/d622a3d284ebaa2da34552c6e4401865 to your computer and use it in GitHub Desktop.
JavaScript try-catch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var a, b, c; | |
try { | |
b = 'foo'; | |
a = nonExistent; | |
c = 'bar'; | |
} catch(e) {} | |
console.log(a, b, c); // 'foo', undefined, undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since all assignments before the first throw are executed, should you order assignments inside a try block by priority or likelihood of success?