美文网首页
展开数组

展开数组

作者: asmuzi | 来源:发表于2018-12-21 15:19 被阅读0次
    展开数组
    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <script src="./lib/jquery.js"></script>
        <script>
            let arr = [12, 5, 8];
    
            function sum(a, b, c) {
                console.log(a + b + c);
            }
    
            sum(...arr);
        </script>
    </head>
    
    <body>
    
    </body>
    
    </html>
    
    展开数组2
    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Document</title>
        <script src="./lib/jquery.js"></script>
        <script>
            let arr = [12, 5, 8];
            let arr2 = [6, 32, 51];
    
            let res = [...arr, ...arr2];
    
            console.log(res);
        </script>
    </head>
    
    <body>
    
    </body>
    
    </html>
    

    相关文章

      网友评论

          本文标题:展开数组

          本文链接:https://www.haomeiwen.com/subject/vmomkqtx.html