1 functionhehe (o,oo) {2o = ' xoxo '3Oo.ins.name = ' Zhangmingzhi; '4 }5 varobj = {6 ins:{7 8 }9 }Ten hehe (obj.ins,obj); OneConsole.log (obj);
In case 1, when the passed parameter is OO, for a reference type, the value of the parameter modification is reflected externally as obj.
Case 2, the passed parameter is O, is a reference type, the value of the parameter modification is not reflected in the external obj.ins
According to the conjecture of Scenario 2: It is possible that obj's reference address on the stack might just be storing obj and ins on the real address on the heap. If the obj.ins is passed in as a parameter, then the operation of this incoming value is not the value of the stack address, natural in the method can not be changed to reflect the Obj object outside the
PS: Above is just conjecture, go back to turn over the book.
When a function passes in a parameter is a reference type of several cases and phenomena.