地址值

1. const obj1 ={
name:'a'
}
const obj2 = {
name: 'a'
}
const arr = [1,2,3];
const arr2 = [1,2,3]
console.log(obj1 == obj2, arr == arr2)//false,false
 
2.var obj1 ={
name:'a'
}
var obj2 = obj1;
obj2.name = 'b';

console.log(obj1.name) //b
3.
 
var arr = [1,2,3];
var arr2 = arr;
arr2[0] = 4;
arr[2] =5
console.log(arr, arr2) //[ 4, 2, 5 ] [ 4, 2, 5 ]
posted @ 2019-08-02 08:55  江山一族  阅读(146)  评论(0编辑  收藏  举报