函数剩余参数与 展开运算符
//剩余参数 function sum(...arr){ console.log(arr) } sum(3,4,5,6) // 求数组最大值 let arr = [1,44,7,88] console.log(Math.max(...arr)) //合并数组 let arr2 = [2,5,77] arr2= [...arr,...arr2] console.log(arr2)
//剩余参数 function sum(...arr){ console.log(arr) } sum(3,4,5,6) // 求数组最大值 let arr = [1,44,7,88] console.log(Math.max(...arr)) //合并数组 let arr2 = [2,5,77] arr2= [...arr,...arr2] console.log(arr2)