搜索文档
ES5 语法
使用 arguments 变量,剪头函数中没有 arguments
js
function test(){
console.log(arguments);
}
test(1,2,3,4,5);
ES6
使用 rest 参数
jslet test = (...options) => { console.log(options); } test(1,2,3,4,5);
rest 参数必须放在形参列表的末尾
jslet test = (a,b,...options) => { console.log(a,b,options); } test(1,2,3,4,5);
