Constructor and prototype, as the names suggest, mean the builder (constructor) and the prototype.
From a semantic perspective, if object A constructs object B, then A is the constructor of B. If the form of object A comes from object B, then object B is the prototype of A.
Let’s look at a piece of code:
function Person() { Person.prototype.name = "myname"; Person.prototype.age = 18; Person.prototype.sayName = function () { alert(this.name); }; } var person1 = new Person(); person1.sayName(); Here, Person is the constructor of Person.prototype. Why? Because Person constructed Person.prototype. However, the prototype of person1 is not Person.prototype. When person1 is initialized, it can be understood as a copy of Person (i.e., a new instance) is given to person1. Every time Person is instantiated, it inherits (just called inheritance for convenience) a copy of name, age, and sayName from its prototype. person1 is a copy of Person, but the prototype is not copied, so the prototype of person1 is undefined.
...