I am reading a Stoyan Stefanov article focused on JavaScript objects and am completely confused. Let's say I have a function:
function Test(){
this.greeting = 'hello';
}
Test.prototype.farewell = "bye"
test = new Test();
test.constructor;
test.constructor.prototype;
test.constructor.prototype.constructor;
The book says that since the prototype is an object, it must have a constructor. But, as the above example shows, the prototype constructor is the same as the constructor test. those.Test()
Is this expected?
The book says that "it may take some time, but in the end you get an inline object Object()that is the parent of the highest level." However, I seem to be stuck in an infinite loop, because all my constructors in the chain are returning Test(), so how can I get to Object().
- ? ( , .)