Last active
September 15, 2015 04:37
-
-
Save kylev/d6187cac9292a9702487 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 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