Var vs. Let Keyword With Global Object

  global, javascript, let, object, var

When we use the var keyword outside of a function, it creates a global variable and attaches that global variable to window object in the browser. In contrast, when we use a let keyword to declare a global variable, that global variable is not attached to the window object. Then, where does the global variable declared by let keyword go?

Source: Ask Javascript Questions

LEAVE A COMMENT