> You wrote constr2 instead of once constr2 and once constr1.
Right. Correct version:
function inheritsFrom(sub, super) {
return super.prototype.isPrototypeOf(sub.prototype);
}
> And doesn't your function do exactly the same thing as instanceof?
No:
function isInstanceOf(instance, type) {
return type.prototype.isPrototypeOf(instance);
}
You could thus rewrite inheritsFrom() as follows.
function inheritsFrom2(sub, super) {
return sub.prototype instanceof super;
}
But I like the explicitness of the original version.
--
Dr. Axel Rauschmayer
[email protected]
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss