Js prototype

function People(name){
             this.name=name;
          //
          this.Introduce=function(){
            console.log("My name is "+this.name);
          }    
         }
          //
        People.Run=function(){
         console.log("I can run");
        }
        //
        People.prototype.IntroduceChinese=function(){
          console.log(""+this.name);
        }
        //
        var p1=new People("");
        p1.Introduce();
        People.Run();
        p1.IntroduceChinese();

recently I am learning the prototype of js, the example of searching on the Internet, what is the difference between object method and class method and prototype method? How to choose in the process of practical application?

Feb.28,2021

Hello, first of all, you have to understand what new has done
goes deep into object-oriented and prototyping. re-recognize new]

after reading this article, you should be able to understand that
object method is a [constructor] bound to the instance of constructor People . You can understand that
class method is bound to the constructor People itself.
prototype method is bound to the prototype attribute of constructor People. The purpose is to make the instance of the constructor People be able to call the prototype method of the constructor People through its own _ _ proto__ attribute

.

if you don't have a thorough understanding of the concept of class / instance , I suggest you read this article I wrote
deep into object-oriented and prototyping [Concepts 1]

digression

I guess privately how you should choose in the process of practical application. this problem is because you don't know anything about object-oriented programming

this proposition is too big. If you are free, you can read the blog I have written. I hope it will be helpful to you.

goes deep into object-oriented and prototyping [concept 2]
goes deep into object-oriented and prototyping [concept 3]-- Prototyping chain and inheritance


The

object method is owned only by the current object, and modifying it does not affect other objects of the same class.

the prototype method is common to all objects of the same class, and the modification affects all objects of that class.

class methods are static methods of this class, only through the class name. The method name () is called in this way, not through the object. Called in the form of method name () . And the this when the class method is called is not the same as the object method. The this of the former is the constructor of the class, while the this of the latter is the current object of the class.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9f8d9-1a67.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9f8d9-1a67.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?