var p1 = {name:"john",age:20};
var p2 = {name:"lucy",age:10};
function model1(obj){
obj={name:'0000'};
}
function model2(obj){
obj.name = 'back';
}
model1(p1);
model2(p2);
console.log(p1);
console.log(p2);
疑问:为什么p1没有变?
var p1 = {name:"john",age:20};
var p2 = {name:"lucy",age:10};
function model1(obj){
obj={name:'0000'};
}
function model2(obj){
obj.name = 'back';
}
model1(p1);
model2(p2);
console.log(p1);
console.log(p2);
疑问:为什么p1没有变?