JS 引用
2020-12-13 04:45
标签:style blog class code c java JS 引用,搜素材,soscw.com JS 引用 标签:style blog class code c java 原文地址:http://www.cnblogs.com/cart55free99/p/3734358.htmlvar arr1=[1,2,3,4];
var arr2=arr1;
arr2.push(5);
console.log(arr1);//和arr2一样
console.log(arr1==arr2);//true
console.log(arr1===arr2);//true
function Cat(name){
this.name=name;
}
var p1=new Cat(‘tom‘);
var p2=new Cat(‘tom‘);
console.log(p1==p2);//false
p2=p1;
console.log(p1==p2);//true
p1.name=‘toms‘;
console.log(p2.name);//toms