const _arr = [[21,213],[1,43,125,89],[[23,54],90,389],12]; [...new Set(_arr.flat(Infinity))].sort((a,b)=>{ return a-b }) (11) [1, 12, 21, 23, 43, 54, 89, 90, 125, 213, 389]