Last active
February 18, 2016 09:07
let vs var
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 ES6example(){ | |
//x is *not* visible out here | |
for( let x = 0; x < 5; x++ ) { | |
//x is only visible in here (and in the for() parentheses) | |
}; | |
//x is *not* visible out here | |
}; | |
function notES6example(){ | |
//y *is* visible out here | |
for( var y = 0; y < 5; y++ ) { | |
//y is visible to the whole function | |
}; | |
//y *is* visible out here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment