1. Native JavaScript implementation
The code copy is as follows:
var array1 = ["a", "b"];
var array2 = ["c", "d"];
I want to merge and become like this:
The code copy is as follows:
<span style="font-weight:bold">var</span> <span style="font-weight:bold">array</span>= [<span style="color:rgb(221,17,68)">"a"</span>, <span style="color:rgb(221,17,68)">"b"</span>, <span style="color:rgb(221,17,68)">"c"</span>, <span style="color:rgb(221,17,68)">"d"</span>];
Available
The code copy is as follows:
arr1.concat(arr2);
2. Jquery implementation
The code copy is as follows:
$.merge(array1,array2);
console.log($.unique(array1));