//Method 1
//rearrange the digits to create the highest possible number
function descendingOrder(n){
return parseInt(String(n).split('').sort().reverse().join(''));
}
console.log(descendingOrder(15)); // result: 51
console.log(descendingOrder(22314)); // result: 43221