vara={"x":1};varb=a;console.log(b.x);a.x=2;console.log(b.x);a={"x":3};console.log(b.x);a.x=4;console.log(b.x);为什么输出的是1222
2 回答
慕桂英4014372
TA贡献1871条经验 获得超13个赞
vara={"x":1};//a:object#1{"x":1}varb=a;//b:object#1{"x":1}console.log(b.x);//1a.x=2;//a,b:object#1{"x":2}console.log(b.x);//2a={"x":3};//a:object#2{"x":3}console.log(b.x);//2a.x=4;//a:object#2{"x":4}console.log(b.x);//2
添加回答
举报
0/150
提交
取消