Created
June 9, 2019 19:49
-
-
Save CodeDraken/a5ca30acd40307ee7087bfe5c6d9e455 to your computer and use it in GitHub Desktop.
Demonstrating block scope in a loop
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 loopScope () { | |
| var i = 50 | |
| var j = 99 | |
| for (var i = 0; i < 10; i++) {} | |
| console.log('i =', i) | |
| for (let j = 0; j < 10; j++) {} | |
| console.log('j =', j) | |
| } | |
| loopScope() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment