Suppose this code:
function ClassOne() { this.propClassOne = 'hello1'; } function ClassTwo() { ClassOne.apply(this); this.propClassTwo = 'hello2'; } function ClassThree() { ClassTwo.apply(this); this.propClassThree = 'hello3'; } ClassTwo.prototype = Object.create(ClassOne.prototype); ClassTwo.prototype.constructor = ClassTwo; ClassThree.prototype = Object.create(ClassTwo.prototype); ClassThree.prototype.constructor = ClassThree; var obj = new ClassThree(); console.log(typeof obj, obj); var newObj = Object.create(obj); console.log(typeof newObj, newObj); objis an instance of which class in this case?ClassOnea super class forClassTwoandClassThreeor only forClassTwo?- And accordingly
ClassThreeis a subclass of onlyClassTwoor andClassOneas well?
In short, explain how to properly call them in relation to each other.
And if we add to the code above:
var newObj = Object.create(obj); - Does
newObjbecome an instance ofobj?
Help me to understand.