better.js
better.js copied to clipboard
instanceof
I notice that you use instanceof a few times in your strong typing code.
Unfortunately, instanceof will not work correctly when dealing with multiple frames in a window. The MDN docs take note of this. There are those who consider instanceof to be ultimately worthless for that reason.
From what I've read on the subject Object.prototype.toString() is the current best replacement for instanceof.
For example, validator.js uses it.
interesting point! How to handle your own class in this context ?
like
var MyClass = function(){
console.log('super class')
}