What is the default prototype of the js prototype chain
This article mainly explains "what is the default prototype of the js prototype chain". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the default prototype of the js prototype chain".
1. By default, all reference type values inherit Object, which is also achieved through the prototype chain.
2. The default prototype of all functions is an instance of Object, so the default prototype contains an internal pointer to Object.prototype.
Example
/ / parent constructor function Father () {this.name = "father" this.house = "cottage"} / / prototype method Father.prototype.alertName = function () {console.log (this.name)} / / Child constructor function Children () {this.name = "children"} / / implement inheritance: prototype object of child constructor = instance object of parent constructor Children.prototype = new Father () / / create a subinstance let c = new Children () / / use the method on the Object prototype console.log (c.hasOwnProperty ('name')) / / true thank you for reading The above is the content of "what is the default prototype of js prototype chain". After the study of this article, I believe you have a deeper understanding of what the default prototype of js prototype chain is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!