Skip to content

Instantly share code, notes, and snippets.

@kylev
Last active September 15, 2015 04:37
Show Gist options
  • Save kylev/d6187cac9292a9702487 to your computer and use it in GitHub Desktop.
Save kylev/d6187cac9292a9702487 to your computer and use it in GitHub Desktop.
function noBar() {
console.log(bar());
}
// ReferenceError: bar is not defined
function hoistedVar() {
console.log(bar());
var bar = function() {
return 42;
};
}
// TypeError: undefined is not a function
function hoistedFunc() {
console.log(baz());
function baz() {
return 42;
};
}
// 42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment