I am trying to understand the reasons for the difference in the response to the following:
case a
var x
is not declared. So, when I run:
console.log(x)
I get the expected response: Uncaught ReferenceError: x is not defined
case b
let obj = { }
console.log(obj.x)
In this case, undefined
gets printed.
Question
In both cases, the binding x
is not defined. What explains the difference in the responses ?