Charlie Harvey

#805

It is puzzling why the two statements below are both true. String.proto === String.constructor.proto; // true String.proto.constructor === String.constructor; // true

Consider the code below:

String.proto; // function () { [native code] } and String.proto.constructor; // function Function() { [native code] }

whereas :

String.constructor; // function Function() { [native code] } and String.constructor.proto; // function () { [native code] }

I can maybe see why the constructor of the String prototype resembles the Function object; but I don’t see why the prototype of the String constructor is the String prototype.

But here is the really weird part:

String.constructor; //function Function() { [native code] } String.proto.constructor; // function Function() { [native code] } Function; // function Function() { [native code] }

String.proto.constructor === String.constructor; // true String.proto.constructor === Function; // true

So, it would seem that the below would be true; but it turns out to be false String.contructor === Function // false

That makes no logical sense to me. That appears utterly contradictory: If A = B, and B = C, then by the transitive property of algebra, A = C. Right ? The string objects prototype constructor equals the string object’s constructor; the String object’s prototype’s constructor equals the Function object; but the String object’s constructor does not equal the Function object !