functionfoo(param1, param2,...params){
console.log(param1);
console.log(param2);
console.log(params);}foo("a","b",1,2,3);//a b [1,2,3]foo("a","b");//a b []
数组解构
let arr =[1,2,3];
console.log(...arr);//1 2 3
字符串解构
let str ="abcde";
console.log(...str);// a b c d e