class A {}
class B extends A {}
const o1 = new A();
// true, because Object.getPrototypeOf(o1) === A.prototype
console.log(o1 instanceof A);
// false, because B.prototype is nowhere in o1's prototype chain
o1 instanceof B;
const o2 = new B();
// true, because Object.getPrototypeOf(Object.getPrototypeOf(o2)) === A.prototype
console.log(o2 instanceof A);
// true, because Object.getPrototypeOf(o2) === B.prototype
console.log(o2 instanceof B);
Y2xhc3MgQSB7fQpjbGFzcyBCIGV4dGVuZHMgQSB7fQoKY29uc3QgbzEgPSBuZXcgQSgpOwovLyB0cnVlLCBiZWNhdXNlIE9iamVjdC5nZXRQcm90b3R5cGVPZihvMSkgPT09IEEucHJvdG90eXBlCmNvbnNvbGUubG9nKG8xIGluc3RhbmNlb2YgQSk7Ci8vIGZhbHNlLCBiZWNhdXNlIEIucHJvdG90eXBlIGlzIG5vd2hlcmUgaW4gbzEncyBwcm90b3R5cGUgY2hhaW4KbzEgaW5zdGFuY2VvZiBCOwoKY29uc3QgbzIgPSBuZXcgQigpOwovLyB0cnVlLCBiZWNhdXNlIE9iamVjdC5nZXRQcm90b3R5cGVPZihPYmplY3QuZ2V0UHJvdG90eXBlT2YobzIpKSA9PT0gQS5wcm90b3R5cGUKY29uc29sZS5sb2cobzIgaW5zdGFuY2VvZiBBKTsKLy8gdHJ1ZSwgYmVjYXVzZSBPYmplY3QuZ2V0UHJvdG90eXBlT2YobzIpID09PSBCLnByb3RvdHlwZQpjb25zb2xlLmxvZyhvMiBpbnN0YW5jZW9mIEIpOwo=