JS 引用

var 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
上一篇:LPTHW 笨办法学python 20章


下一篇:安装PHPStudy2014,打开端口出现80端口 PID4 进程:System-windows服务器应用