Why does prototype inheritance in the prototype chain have such a different result?

< H2 > purpose: < / H2 >
ABBCBObjectC?
< H2 > my understanding: < / H2 >
prototypenew B(),Anew B()__proto__BBnew C() ?

the first way to write:


:


Mar.13,2021

js has variable improvement, so the first paragraph is equivalent to

function A () {
  
}
function B () {

}
function C () {
  
}
var aObj;
A.prototype = new B(); // ABobject
A.prototype.constructor = A;

B.prototype = new C();
B.prototype.constructor = B; // B

// A.prototype = new B(); // newBC.prototype

aObj = new A();
console.log(aObj);

Update:
your puzzle may be that if I change the prototype property of a method, will the original new object automatically update the prototype object?

function B () {}
let b = new B()
console.log(b.__proto__ === B.prototype) // true
B.prototype = {} // B
console.log(b.__proto__ === B.prototype) // falsenew

Abstract the above process and change it to the following:

console.log(b.__proto__ === B.prototype) // true
B.prototype = {} // B
console.log(b.__proto__ === B.prototype) // false

simplify, use c instead of b.protoplast , d instead of B.prototype :

console.log(c === d) // true
d = {}
console.log(c === d) // false

that is, at first c and d point to the same object, and then make d point to another object, then will c automatically update to point to the new object?
answer: why is it updated automatically?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3975a-34561.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3975a-34561.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?