Javascript’s undefined

  node.js, question
var obj1={a:1,b:2};
 
 console.log(obj1.c);  //undefined
 console.log(global.c);  //undefined
 console.log(c);  //Report an error

Javascript’s definition of undefined is a declared but uninitialized variable, so why does obj1.c return undefined without reporting an error?

1) When a variable is declared but not initialized-assigned, the value of this variable is undefined
2) for variables that have not been declared, only typeof operation can be performed, and other operations will report ReferenceError: undefined error
3) Operation on an undefined variable will report TypeError: cannot read attributes from an undefined object
4) For an undefined variable in a function, it will look up its variable definition along its closure call link. If the definition of this variable has not been found up to the global context, it will report an undefined error of the variable. If there is a definition but no assignment, it will return undefined´╝Ť; If defined and assigned, the value defined by this variable will be returned.
5) By default (no special settings are made for an object’s attributes, such as configuration cannot be changed, cannot be enumerated, cannot be read or written, etc.), for the value of an object’s attributes, first check whether its attributes exist along the prototype chain, and if so, return the corresponding value; If there is no direct return undefined
console.log(object1.c);Andconsole.log(global.c);Suit rule 5
console.log(c);Applicable rule 4

For the example of rule 4

(function(){
 function a(){
 console.log(b);  //report an error, b is not defined
 bracket
 a();
 }());
(function(){
 var b;
 function a(){
 console.log(b);  //output undefined without error
 bracket
 a();
 }());

It can be understood that the entire JS runs in a closure environment, and the top level of this closure is the global environment.