Hi i am trying to solve this task of a javascript challenge : The task is to make a function that can take any non-negative integer as a argument and return it with its digits in descending order. Essentially, rearrange the digits to create the highest possible number.

Examples:
Input: 21445 Output: 54421

Input: 145263 Output: 654321

Input: 1254859723 Output: 9875543221


My thinking is to break the number into individual strings and push into array then sort them descending way then make it a number again . But is there a better way to handle this?