jQuery-工具方法-merge方法

与世无争的帅哥 提交于 2019-11-29 06:39:17
<!DOCTYPE html>
<html lang="zh">
<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>
</head>
<body>
    <script src="./jquery.js"></script>
    <script>
         var colors1 = ['red', 'green', 'blue'];
         var colors2 = ['black', 'white', 'purple'];
         var colors3 = ['yellow', 'pink', 'orange'];
        
        //  将第二数组合并到第一个数组中,该方法只能合并 2 个数组
        //  console.log($.merge(colors1, colors2, colors3))

         console.log(colors1.concat(colors2, colors3))
    </script>
</body>
</html>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!