let vs var
for (let i = 0; i < 3; i++) {
// This is the Max Scope for 'let'
// i accessible âï¸
}
// i not accessible â
for (var i = 0; i < 3; i++) {
// i accessible âï¸
}
// i accessible âï¸
var is scoped to the nearest function block, and let is scoped to the nearest enclosing block.
Comments





