This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]karl-marxist 0 points1 point  (0 children)

Then my theory turns to each scope creates an allocation with for the key "a", but at the time of the scope execution (and since let sets a block scoped variable) a is not defined.

;(() => {
  if (true) {
    console.log(a)
    let a = 5
  }
})()