Last updated 4 years ago
Was this helpful?
convert as string
split process-1 to each character
sort process-2 (DESC)
join process-3 as one string
parse process-4 as number
const maxNumber = (n) => Number([...String(n)].sort((a, b) => b - a).join(''));