- 默认值传参
function fn(x, y = 1) {
console.log(y);
}
fn(100);
- 形参赋值结合解构赋值
function fn({ x, y=100 }) {
console.log(x, y);
}
fn({ x: 1});//1,100
- 剩余运算符
function sum(...a){
console.log(a);
}
sum(1,2,3,4,5)//12345