Jquery constructor

// What is the constructor, the new instance is that the constructor is an object
 // no return value then in other languages returns an instance of the object.
// if the return value check its return value is a reference type. If the non-reference type, such as the basic type (string, number, boolean, null , undefined) with no return value is the same, the actual return instantiated objects.
// If the return value is a reference type, the return value is actually a reference type.
// What is a reference type 
 // JS basic data types undefined Object Boolean function String Number The Null
 @ basic types: Number The String Boolean undefined null
 @ reference types: Object Function 


 
  function the Person2 () { 
   the this .height = ' 180 [ ' ;
    return   ' . 1 ' ;     
 } 
 function person3 () { 
   the this .height =' 180 [ ' ;
    return [ ' A ' ]; 
 } 
 
 var P2 = new new the Person2 (); // returns the base type 
 var P3 = new new person3 (); // return a reference type 
 
 console.log (p2.height);   // 180 [ 
 the console.log (p3.height);   // undefined 
 the console.log (P3 [ 0 ]);       // 'A' 
 the console.log ( typeof   [ ' A ' , ' B ' ]);

 

Guess you like

Origin www.cnblogs.com/Dainney/p/11105021.html