Created
April 12, 2021 08:03
-
-
Save frivolta/acf3f8d477434f25b6cff50b846f35ef to your computer and use it in GitHub Desktop.
jmawd - initial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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