Skip to content

Instantly share code, notes, and snippets.

@mrmnmly
Last active February 18, 2016 09:07
let vs var
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