Created
May 7, 2020 18:27
-
-
Save Nathan-Nesbitt/fdf87d8d3bac4038e9f110642e7e4b9e to your computer and use it in GitHub Desktop.
Example of Block Scoped Variables
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
| // Create variable for only the outer block // | |
| let i = 22; | |
| // Create and loop over inner block variable // | |
| for(let i = 0; i < 10; i++) { | |
| console.log(i); | |
| } | |
| // Print outer block variable // | |
| console.log(i); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sample code for https://nathan.nesbitt.ca/blog-posts/IntroductionToJavascript.html