Skip to content

Instantly share code, notes, and snippets.

@CodeDraken
Created June 9, 2019 19:49
Show Gist options
  • Select an option

  • Save CodeDraken/a5ca30acd40307ee7087bfe5c6d9e455 to your computer and use it in GitHub Desktop.

Select an option

Save CodeDraken/a5ca30acd40307ee7087bfe5c6d9e455 to your computer and use it in GitHub Desktop.
Demonstrating block scope in a loop
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