Skip to main content
13 events
when toggle format what by license comment
Jun 8, 2021 at 13:48 comment added dekisha This creates object instead of array
May 26, 2021 at 11:12 history edited Roman Nazarevych CC BY-SA 4.0
It doest concatenate arrays but add new array as last element of `array1`
May 26, 2021 at 11:07 comment added Roman Nazarevych array1.push(...array2) // => don't remove duplication it doest concatenate arrays but add new array as last element of array1
Nov 14, 2019 at 1:32 comment added Rakibul Haq for merging different objects without duplicating : stackoverflow.com/a/54134237/3131433
Sep 16, 2019 at 10:55 comment added x-magix this is really the best answer, I tried to compare with array.find by id, array concact and wasnt fast like yours solution, best man thank you
Mar 7, 2019 at 19:12 comment added W Biggs Does not work with an array of objects, as it'll only merge object references and doesn't care if the objects themselves are equal.
Mar 14, 2018 at 9:21 comment added Thanh Nguyen should be accepted answer for the modern of Javascript.
Jan 5, 2018 at 2:16 comment added Jun Note that for set can't deduplicate two objects that have the same key value pairs unless they are the same object references.
Nov 17, 2016 at 3:21 history edited Abdennour TOUMI CC BY-SA 3.0
deleted 12 characters in body
Oct 19, 2016 at 14:45 comment added David Noreña so how you would do it ?
Oct 10, 2016 at 10:13 comment added user6445533 1st/2nd example is no union at all + 1st example blows up the stack for large Arrays + 3rd example is incredibly slow and consumes a lot of memory, since two intermediate Arrays have to be build + 3rd example can only be used for union with a known number of Arrays at compile time.
Aug 14, 2016 at 8:14 history edited Abdennour TOUMI CC BY-SA 3.0
added 70 characters in body
Aug 14, 2016 at 8:08 history answered Abdennour TOUMI CC BY-SA 3.0