-
-
Save henryspivey/c02a2e1ddde41c20b2c7fda3b4688fa9 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
| //var hoisting vs let hoisting | |
| //WHAT will be the output from this code and why? | |
| function f() { | |
| console.log('var', area); // undefined | |
| if(area !== 'undefined) { | |
| console.log('var', area); | |
| } | |
| console.log('let', name); // reference error | |
| try { | |
| console.log('let', name); | |
| } catch(err) { | |
| console.log(err) | |
| } | |
| let name = 'Bert'; | |
| var area = 'Geology'; | |
| } | |
| f(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment