by randomfool · 7y ago · 0 comments
static isDog (animal) {
return Object.getPrototypeOf(animal).constructor.name === this.name;
}
Yes- static isDog (animal) {
return animal instanceof Dog;
} 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.