//浅拷贝:
let arr=[1,2,3,4]
let arr2=arr
arr[3]=0
console.log(arr,arr2)
//output: (4) [1, 2, 3, 0] (4) [1, 2, 3, 0]
//深拷贝1:
var arr3=[1,2,3,4]
var arr4=[]
for(var i=0;i<arr.length;i++){
arr4.push(arr3[i])}
console.log(arr4)
//output: (4) [1, 2, 3, 4]
//深拷贝2,slice:
var arr7=[1,2,3,4]
var arr8=arr7.slice(0,4)
arr7[3]=0
console.log(arr7,arr8)
//output: (4) [1, 2, 3, 0] (4) [1, 2, 3, 4]