3 ms·
Or, if you want to check “is a Dog and not an instance of some subtype of it”: static isDog (animal) { return Object.getPrototypeOf(animal).constru
by chrismorgan 8y ago
Or, if you want to check “is a Dog and not an instance of some subtype of it”:
static isDog (animal) {
return Object.getPrototypeOf(animal).constructor === this;
}
Definitely no need for the `.name` check—that weakens it enormously, especially in the presence of minification.