Skip to content

Instantly share code, notes, and snippets.

@frivolta
Created April 12, 2021 08:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frivolta/acf3f8d477434f25b6cff50b846f35ef to your computer and use it in GitHub Desktop.
Save frivolta/acf3f8d477434f25b6cff50b846f35ef to your computer and use it in GitHub Desktop.
jmawd - initial
const firstArr = new Array(200).fill(undefined).map((val, i) => `item${i}`)
const secondArr = new Array(250).fill(undefined).map((val, i) => `item${i}`)
const result = secondArr.reduce(
(acc, item) => {
return acc.includes(item) ? acc : [...acc, item]
},
[...firstArr]
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment