Created
January 27, 2017 18:50
-
-
Save bluepnume/362297a9d4cb1426df65a866e25fb12b 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 | |
| 3:5 error 'total' is assigned a value but never used no-unused-vars | |
| 8:10 error 'total' used outside of binding context block-scoped-var | |
| 8:10 warning 'total' was used before it was defined no-use-before-define | |
| 9:13 error 'total' is already declared in the upper scope no-shadow | |
| 12:12 error 'total' used outside of binding context block-scoped-var |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment