$.merge()
方法來合併兩個陣列。$.merge(arr1, arr2)
$.merge() 方法會合併 arr1 和 arr2,然後返回新的陣列。<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <script src="js/jquery-1.12.4.min.js"></script> <script> $(function(){ var frontEnd = ["HTML", "CSS", "JavaScript"]; var backEnd = ["PHP", "JSP", "ASP.NET"]; var result = $.merge(frontEnd, backEnd); console.log(result); }) </script> </head> <body> </body> </html>控制台輸出結果如圖 1 所示。