0

I've looked over Google with multiple searches and searched through Stack Overflow but I can't find and answer to this simple problem. Here's some example code to show what I mean. I want to detect the class A without also detecting all class B objects

class A {}
class B extends A {}

let x = new A();
let y = new B();

console.log(x instanceof A && y instanceof A); // Returns true because Y inherits
console.log(y isMemberOf A)); // Should return false.

Typeof just says "object" which isn't helpful. What can I use to say "isMemberOf" in real JavaScript?

DexieTheSheep
  • 439
  • 1
  • 6
  • 16

0 Answers0