Created
December 5, 2014 09:54
-
-
Save mo-gr/ec648e87eee8d9d41b81 to your computer and use it in GitHub Desktop.
Try-Catch of doom
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
try { | |
var a = func; | |
function func() {return "a";}; | |
console.log(a()); | |
} catch (e) { | |
console.log(e); | |
} | |
// ReferenceError: func is not defined |
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 = func; | |
function func() {return "a";}; | |
console.log(a()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment