Last active
January 27, 2017 18:45
-
-
Save bluepnume/6b2cf6b3e2616f13393940900c93b368 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 DEFAULT_TOTAL = 10; | |
| var total = 5; | |
| function getTotal() { | |
| "use strict"; | |
| if (!total) { | |
| var total = DEFAULT_TOTAL; | |
| } | |
| return total; | |
| } | |
| console.log('Total:', getTotal()); | |
| hoisting.js | |
| #1 'total' used out of scope. | |
| return total; // Line 12, Pos 12 | |
| #2 Redefinition of 'total' from line 2. | |
| var total = DEFAULT_TOTAL; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment