JS: OOP - Inheritance
接續上一篇的物件導向介紹的OOP基本介紹,這篇說明Object.create、contstructor function和ES6 class語法如何建立prototypes(原型)之間的繼承關係,形成所謂的原型鏈(prototype chain)
Object.create
複習一下,Object.create方法暗地裡其實就是用來鏈結某東西與prototype之間的關係,例如前一篇是用 const jeck = Object.create(UserProto),讓物件jeck可以繼承Use...
urlun0404.hashnode.dev1 min read