Skip to content

Instantly share code, notes, and snippets.

@mo-gr
Created December 5, 2014 09:54
Show Gist options
  • Save mo-gr/ec648e87eee8d9d41b81 to your computer and use it in GitHub Desktop.
Save mo-gr/ec648e87eee8d9d41b81 to your computer and use it in GitHub Desktop.
Try-Catch of doom
try {
var a = func;
function func() {return "a";};
console.log(a());
} catch (e) {
console.log(e);
}
// ReferenceError: func is not defined
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