Created
July 9, 2020 22:15
-
-
Save psynewave/449b0f1c10ef49587708f0420bccee0b to your computer and use it in GitHub Desktop.
One liner for merging arrays with an optional unique flag
This file contains 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 mergeTwoArrays = (a, b, unique = false) => unique != true ? a.concat(b) : [...new Set([...a, ...b])]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment