First, how to create an object
1.new Object ();
2.var a={};
3. Use the function to build the object as follows:
3. Constructor creates object function person () { this.name= "Zhang Dan"; this.age=26; this.gender= "female"; } var p=new person ();//Create a new object that inherits all the properties of the template person () p.height=160; Console.log (Person.prototype)//Only function has prototype, entity No, here print out or an object
Second, what is the object
var obj=new Object (); Console.log (obj)
In the browser print out is as follows:
__proto__:object This is a prototype object. This property is not supported by all browsers. all objects whose final top-level objects are object. A prototype object is also an object.
Third, scope
Global variables, local variables
For example:
var a=100;//global Variables
function Test () {
var a=11;//local Variables
JS Object-oriented