Inheritance problem of javascript prototype chain

I would like to ask why the last instance2.test result in the following set of prototype chain code is h _ 1, br, h _ 2, h _ 3, and h _ 4?

hasn"t an h5 already been push before

?

clipboard.png


test is an instance attribute of the subclass SubType . When var instance2=new SubType () , assign test of instance2 to ["H1", "H2", "h3", "h4"] . Similarly, when you instance1.test.push , you also modify the instance properties of instance1 .

when you visit instance2.name , you can't find the instance property. Then go to the prototype chain and find that SubType.prototype has the attribute name , so return it. Similarly, instance1.name.push also modifies the name attribute of the prototype chain SubType.prototype .

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-1c08e74-32938.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-1c08e74-32938.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?