const sortDigits = num => +[...`${num}`].sort((a, b) => b - a).join('');
или
const sortDigits = num => ''.concat.apply('', num.toString().split('').sort().reverse()) - 0;
или
const sortDigits = num => Number(Array
.from('' + num)
.reduce((acc, n) => (acc[n]++, acc), Array(10).fill(0))
.reduceRight((acc, n, i) => acc + String(i).repeat(n), '')
);
или
const sortDigits = num => Array
.prototype
.reduce
.call(String(num), (acc, n) => ((acc[9 - n] ??= []).push(n | 0), acc), [])
.flat()
.reduce((acc, n) => acc * 10 + n, 0);