1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
This is the basic structure. Each function has a
prototype property. This
prototype field is an object that is applied to all objects created from that function using the
new keyword. Setting the prototype of the Child class to that of the Parent class will create a prototype chain which would then allow the
instanceof feature to work. The Child class would also borrow any attributes it didn’t have that the Parent object would supply. Deleting overriden attributes in the Child class would revert back to use the assigned Parent’s attributes.