Sort Numbers in Descending Order

Published by Matt in

Create a function that takes any non-negative number as an argument and return it with its digits in descending order. Descending order is when you sort from highest to lowest.

Examples

sortDesc(123) ➞ 321

sortDesc(1254859723) ➞ 9875543221

sortDesc(73065) ➞ 76530

Notes

You can expect non-negative numbers for all test cases.

Watch a quick demo on how Edabit works.