Created
November 10, 2025 09:17
-
-
Save kirkegaard/a75edb94137c1d4b11a8e40d4736c101 to your computer and use it in GitHub Desktop.
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
| let a = [1, 3, 5, 0, 0, 0]; | |
| let b = [2, 4, 6]; | |
| function merge(a, b) { | |
| return [...new Set([...a, ...b])].filter(function (item) { | |
| return item !== null && item !== undefined && item !== 0; | |
| }).sort((a, b) => a - b); | |
| } | |
| const res = merge(a, b); | |
| console.log(res); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment