Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - In js, if an object type object is given a user-defined variable name, then the variable name may not be needed.
In js, if an object type object is given a user-defined variable name, then the variable name may not be needed.
Yes, there is no var decoration, which means that this variable is a global variable.

& lt script & gt

var obj = new Object();

obj.a = function(){

name = ' aaa

}

obj . a();

Alarm (name);

& lt/script & gt;

Look at the above column, name is actually an attribute of the window object, which is also a global variable.