Closed RaphiSpoerri closed 5 months ago
Thanks - interestingly, "blah".constructor
seems to return undefined
initially, but if you call String.prototype.constructor
it's fine afterwards - so it seems to be having trouble creating the constructor.
So if you change the order of comparison, it appears to work reliably for me? Is that the same for you?
const cmp = () => String.prototype.constructor == "blah".constructor;
console.log(
cmp() == cmp()
);
I've got a fix for this, but it appears to break some other stuff so I'm going to hold off committing it.
I believe the 'real prototype chain' branch would fix this too.
Regarding primitive types, comparisons like
<T literal>.constructor == <T>.prototype.constructor
do not always give consistent results. For exampleprints
(I'm using the web IDE's Bangle.js 2 emulator, and version
2v18.1
)