两个作用:
1.展开运算符号
2.剩余操作符
//1.展开运算符
const a = [2,3];
const b = [1,...a,4];
console.log(b)//结果是:[1,2,3,4]
//2.剩余操作符
const a = [1,2,3,4,5]
const [b,...c] = a;
console.log(b) //结果是1
console.log(c) //结果是2,3,4,5
两个作用:
1.展开运算符号
2.剩余操作符
//1.展开运算符
const a = [2,3];
const b = [1,...a,4];
console.log(b)//结果是:[1,2,3,4]
//2.剩余操作符
const a = [1,2,3,4,5]
const [b,...c] = a;
console.log(b) //结果是1
console.log(c) //结果是2,3,4,5