Merging of two arrays, store unique elements, and sorting in jQuery
问题 var Arr1 = [1,3,4,5,6]; var Arr2 = [4,5,6,8,9,10]; I am trying to do merge these two arrays and output coming is [1,3,4,5,6,4,5,6] I have used $.merge(Arr1, Arr2); this piece to merge them. Using alert I can see the merged array like above. Now my question is how can I get the following output: [1,3,4,5,6,8,9,10] i.e. the elements should be unique as well as sorted in the same manner I have mentioned. Please help. 回答1: You can use Array.prototype.sort() to do a real numeric sort and use Array