Unlike the var
keyword, when declaring variables using let in the global context, variables will not attach to the window object as they do with var
.
var name = 'CSS'; console.log(window.name); // 'CSS' let age = 26; console.log(window.age); // undefined
let
declarations will still occur inside the global block scope.