Skip to content

Latest commit

 

History

History
23 lines (15 loc) · 810 Bytes

sorted-union.md

File metadata and controls

23 lines (15 loc) · 810 Bytes

Sorted Union 7 Kyu

LINK TO THE KATA - ARRAYS LISTS ALGORITHMS SORTING

Description

Write a function that takes one or more arrays and returns a new array of unique values in the order of the original provided arrays.

In other words, all values present from all arrays should be included in their original order, but with no duplicates in the final array.

The unique numbers should be sorted by their original order, but the final array should not be sorted in numerical order.

Check the assertion tests for examples.

Solution

const uniteUnique = (...array) => [...new Set(array.flat())]