Untitled

Anonymous
plain_text
05/15/2024 11:08 PM
504 B
15
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