12
How does the performance of instanceof fair for "huge libraries"?
Does it travel up the prototype chain one by one, similar to this? :
//..
var _ = john.constructor;
while (true) {
if (_ === Human) {
return true;
}
_ = _.prototype.constructor
}
return false;
//..
Is instanceof relatively unperfomant then, compared to storing a unique interface id number in the property of every object.