对象扩展运算符
实例1:
function f(...arg){
console.log(arg[0]);
console.log(arg[1]);
console.log(arg[2]);
console.log(arg[3]);
}
f(1,2,3);
实例2:
let arr1 = ['www','qxb','com'];
let arr2 = [...arr1];
console.log(arr2);
arr2.push('ljj');
console.log(arr2);
console.log(arr1);
rest运算符
实例1:
function f(first,...arg){
console.log(arg.length);
}
f(0,1,2,3,4,5,6,7);
实例2:
function f(first,...arg){
for(let val of arg){
console.log(val);
}
}
f(0,1,2,3,4,5,6,7);