Last active
April 10, 2016 19:44
-
-
Save addityasingh/d3535ee4ac83842fd2aa5d5926ee85a6 to your computer and use it in GitHub Desktop.
Try catch do not introduce block scope for new declarations
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
(function () { | |
'use strict'; | |
try { | |
undefined(); | |
} catch (err) { | |
var a = 5; | |
console.log(a); // 5 | |
console.log(err); // TypeError: undefined is not a function(…) | |
} | |
console.log(a); // 5 This should be undefined if a was scoped only to catch block. But it isn't. | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment