var a = {name: 1};
var b = a;
console.log(a);
console.log(b);
输出结果:
{ name: 1 }
{ name: 1 }
b.name = 2;
console.log(a);
console.log(b);
输出结果:
{ name: 2 }
{ name: 2 }
var b = {name: 3};
console.log(a);
console.log(b);
输出结果:
{ name: 2 }
{ name: 3 }
var a = {name: 1};
var b = a;
console.log(a);
console.log(b);
输出结果:
{ name: 1 }
{ name: 1 }
b.name = 2;
console.log(a);
console.log(b);
输出结果:
{ name: 2 }
{ name: 2 }
var b = {name: 3};
console.log(a);
console.log(b);
输出结果:
{ name: 2 }
{ name: 3 }
本文标题:js的对象类型
本文链接:https://www.haomeiwen.com/subject/nfsizttx.html
网友评论