Js difference between classes and objects, functions and new understanding

   First, the class: a class of abstract things; (such as: humans, cats)

 

Second, the object: class inside a specific thing; (such as: Xiao Ming humans, cats in jingle cats)
 
 Third, the function (method): object has many attributes, such as: height, weight, sex and so on; and the function is executed action will target such as: eating, drinking, sleeping, sleeping
 
 class Person {// class which only the discharge of these functions will be in a public space such as a memory (the __proto__) inside
  constructor(){
    // class which a function inherent
    this.eat () function if placed inside the constructor when the new class will be executed when it is a feature of the new
  }
  eat(){}
  drink(){}
 }
 . -New features: a function execution; 2 automatically creates an empty object; 3. the object created and this binding; 4. this implicit return (i.e., after the object is instantiated);.
 let person = new Person();
 Understand, look after the lack of time to fix it
    

Guess you like

Origin www.cnblogs.com/jzbs/p/11851692.html