Var obj1={
Name: "true",
}
var obj2=obj1;
Obj1. Name="false";
The console. The log (obj2. Name); //print false
Var obj1={
Name: "true",
}
var obj2=obj1;
Obj1={
Name: "false",
}
The console. The log (obj2. Name); //print true
Want to know why the results of the two kinds of printing is not the same?
CodePudding user response:
The first case, the two variables point to the same memory address,
CodePudding user response: