Skip to content

剩余参数语法糖

...args是 ES6 的新特性剩余参数语法(Rest Parameters),将函数中的多个实参自动打包成一个数组,写法固定:

function(...args){
    console.log(args);//打印出来是个数组
}