Ali*_*ine 0 javascript json javascript-objects
我想了解这个让我感到困惑的概念。
假设我有以下逻辑:
function test(){
var jsonObj_1 = {};
var jsonObj_2 = {};
jsonObj_2 = jsonObj_1;
jsonObj_2.myKey = 3;
console.log(jsonObj_2) // result => {myKey:3}
console.log(jsonObj_1) // result => {myKey:3}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是为什么它永远不会被分配时jsonObj_1等于 {myKey:3}?!