💾arr.uniqueMerge()

// 🔸 array.uniqueMerge() 
Array.prototype.uniqueMerge = function(){
  return this.flat().removeDuplicates();
};

💈範例:

let arrays = [
  [1,2,3],
  [1,2],
  [3,4,5,6],
];

arrays.flat()          // [ 1, 2, 3, 1, 2, 3, 4, 5, 6 ]
arrays.uniqueMerge()   // [ 1, 2, 3, 4, 5, 6 ]

Last updated