var obj = getSomeObject(); // { name: 'wallace' }
var output = hanxiaofengsheng(obj);
// obj --> { name: 'wallace', mo: true }
console.log(obj.name,obj.mo);
console.log(output.name,output.mo);
function getSomeObject(){
var thisObj = new Object();
thisObj.name="wallow";
return thisObj;
}
function hanxiaofengsheng (input) {
var copy = input; // 试图进行所谓"对象复制"
// console.log(copy instanceof input);
copy.mo = true; // 引用类型属性修改, 外部变量受影响
return copy;
}