JS odwrotna int w kolejności malejącej
//Method 2
//rearrange the digits to create the highest possible number
function descendingOrder(n){
let reversed = n.toString().split("").sort((a, b) => b - a).join('');
return parseInt(reversed) * Math.sign(n);
}
console.log(descendingOrder(463)); // result: 643
console.log(descendingOrder(223744)); // result: 744322
Lucky-Magnet