Javascript call Parent constructor in the Child (prototypical inheritance) - How it works?
问题 I know it works, but I don't know why and how. What are the mechanics? // Parent constructor function Parent(name){ this.name = name || "The name property is empty"; } // Child constructor function Child(name){ this.name = name; } // Originaly, the Child "inherit" everything from the Parent, also the name property, but in this case // I shadowing that with the name property in the Child constructor. Child.prototype = new Parent(); // I want to this: if I dont set a name, please inherit "The