SOURCE

let a = [
"1","2","3","4"
];

let a2 = Array.from(a);
a[0]="5"
//至少可以用来深拷贝一个简单数组
console.log(a)// 5,2,3,4
console.log(a2)// 1,2,3,4

//也可以传来一个用来过滤的函数
let events = Array.from(a,item=>(item%2==0))
console.log(events)// false,true,false,true
let like_filter = Array.from(a,item=>{
    if(item%2==0)return item
})
console.log(JSON.stringify(like_filter))//[null,"2",null,4]

//Array.of方法根据传入的参数创建一个新数组
let numbers3 = Array.of(1,2,3);//等同于下面
let numbers4 = [1,2,3];
console.log(numbers3)// 1,2,3
console.log(numbers4)// 1,2,3
console.log(numbers3.toString() == numbers4.toString())//true

//同样可以用Array.of结合"展开运算符..."来对简单数组进行深拷贝
let a3 = Array.of(...a2);
a2[a2.length-1]="5"
console.log(a2)// 1,2,3,5
console.log(a3)// 1,2,3,4
console 命令行工具 X clear

                    
>
console