Loading

函数剩余参数与 展开运算符

//剩余参数
            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)

 

 

posted @ 2023-11-05 22:56  mingBolg  阅读(6)  评论(0编辑  收藏  举报