DEV Community

Discussion on: 5 ways to merge arrays in JavaScript and their differences

Collapse
jonrandy profile image
Jon Randy

Using my project 'Metho' - you could implement a syntax something like:

const arr1 = [1, 2, 3], arr2 = [1, 2, 3, 4, 5, 6]

arr1[plus(arr2)]  // [1, 2, 3, 1, 2, 3, 4, 5, 6]
arr1[plus(arr2, {dedupe: true})]  // [1, 2, 3, 4, 5, 6]
Enter fullscreen mode Exit fullscreen mode