123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <script>
- /* rest 剩余的 */
- // function fn(a,b,...rest){
- // console.log(a)
- // console.log(b)
- // console.log(...rest)
- // }
- // fn(1,2,3,4,5,6,7,8,9)
- // function fn1(...rest){
- // console.log(rest)
- // }
- // fn1(1,2,3,4)
- // function fn(){
- // console.log(arguments)
- // /* 取到所有剩余的值 */
- // }
- // fn(1,2,3,4)
- // function fn1(a,b,rest){
- // var x = a
- // let c = b
- // var d = rest
- // fn2(d)
- // console.log(x + c)
- // }
- // fn1(1,2,3,4,5,6)
- // function fn2(xx){
- // // console.log(xx)
- // var xx = 30
- // }
- // 3,报错
- // [3,4,5,6] 3
- // 报错
- </script>
- </body>
- </html>
|