如何在保护 b 状态的同时执行以下操作?
var a = function(o){
this.o = o;
this.o.one = 'three';
}
var b = {'one':'two'};
var c = new a(b);
console.log(b.one); //three
我意识到这行得通...
var a = function(o){
this.o = {};
this.o.one = o.one;
this.o.one = 'three';
}
...
但是如果我想“导入”整个对象呢?
编辑
这在这里得到了回答-> JavaScript:如何按值传递对象?
谢谢大家!