Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
377 B
1
Indexable
Never
sortUniqArray(inputArray: any[]) {
    //Flatten the nested arrays
    const flattenedSeconds = inputArray.reduce((acc, curr) => acc.concat(curr), []);

    // Remove duplicates
    const uniqueSeconds = [...new Set(flattenedSeconds)];

    //  Sort the resulting array
    const sorted_uniq_seconds = uniqueSeconds.sort((a, b) => a - b);
    return sorted_uniq_seconds;
  }


Leave a Comment