Confusion With Javascript Inheritance
问题 I'm confused about javascript inheritance. Consider the following code: function parent(firstname, lastname) { this.firstname = firstname || "abc"; this.lastname = lastname || "def"; } function child() { this.childname = "xys"; } parent.prototype.Greetings = function () { alert("sayhi"); } child.prototype = Object.create(parent.prototype); var child1 = new child(); Now, does the child1 object have access to the firstname and lastname properties? I can access the Greetings method (because it's