JavaScript object output in console.log
Changing F.prototype
replaces the content of F
, not the name. The old prototype object still exists and a reference to it is stored internally in each instance of the old F
. You cam check it by calling f.__proto__
´ (deprecated) or Object.getPrototypeOf(f)
.
Note that __proto__
is an accessor proterty (internally a getter, not a real property), so it cannot be changed.