English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

js OOP inheritance implementation (must see)

The reason why Student.prototype uses the create method to create instead of directly assigning the value of Person.prototype is that if we assign, the two will point to the same object. If we want to add new methods to the student class, it will not work. So we use the create method to make Person.prototype the prototype of Student.prototype

If we modify the properties of the bosn prototype, then bosn will be affected. It should be noted that we found that if the bosn prototype object is modified, bosn will not change. For already created instances, modifying the prototype object will not change the instance.

This article on the OOP inheritance implementation of JavaScript (must-read) is all the content that the editor shares with everyone. I hope it can provide a reference for everyone and I hope everyone will support and cheer for the tutorial.

You May Also Like