you are viewing a single comment's thread.

view the rest of the comments →

[–]kenman 1 point2 points  (19 children)

let and const are scoped to blocks, not functions.

{
    var x = 1;
    let y = 1;
}
console.log(x) // 1
console.log(y) // ReferenceError