I am very new to JavaScript and could not understand the code below (code source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/instanceof)
// defining constructors
function C(){}
function D(){}
var o = new C();
// true, because: Object.getPrototypeOf(o) === C.prototype
o instanceof C;
// false, because D.prototype is nowhere in o's prototype chain
o instanceof D;
o instanceof Object; // true, because:
C.prototype instanceof Object // true
C.prototype = {};
var o2 = new C();
o2 instanceof C; // true
// false, because C.prototype is nowhere in
// o's prototype chain anymore
o instanceof C;
Why in the last line "o instanceof C" returns false? I don't understand how "C.prototype = {}" removes "C.prototype" from o's prototype chain. thank you!