结构赋值
按照一定的模式,从数组和对象中提取值,对变量进行赋值
let {age , name, sex} = {age:'23',name:'wind',sex:'male'}
拓展运算符
let arr = [1 ,2 ,3];
let arr1 = arr; // 浅拷贝
let arr2 = [...arr]; // 深拷贝,相当于之前数组截取
console.log(arr1 === arr) // true
console.log(arr2 === arr) // false
let arr3 = [...arr, 4, 5, 6];
console.log(arr3) // [1,2,3,4,5,6] 合并数组
rest运算符
getRest(a, ...rest){
console.log(a); // 1
console.log(rest) // [2,3,4]
}
getRest(1,2,3,4);
数组include()
let arr = [1,2,3];
console.log(arr.include(2)) // true