rest语法|剩余参数|归并参数
程序员文章站
2022-04-21 10:51:27
...
// rest语法|剩余参数|归并参数
f = (...arr) => arr;
console.log(f(1, 2, 3, 4, 5, 6, 7, 8, 9));
// ...后面跟集合数据,可以将集合展开 ***********************
console.log(...[1, 2, 3, 4, 5, 6]);
f = (a, b, ...arr) => `${a},${b},"|",${arr}`;
console.log(f(1, 2, 3, 4, 5, 6));
f = (a, b, ...arr) => arr;
console.log(f(1, 2, 3, 4, 5, 6));
f = (a, b, ...arr) => `${arr}`;
console.log(f(1, 2, 3, 4, 5, 6));