Untitled

 avatar
unknown
plain_text
a year ago
377 B
3
Indexable
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;
  }


Editor is loading...
Leave a Comment