I have 4 digit integer number. I have to get the minimal number which is a combination of those original numbers (can't start with zeros)
function changeDigitsOrder(num){
return Number(num.toString().split('').sort().join(''))
}
It works for numbers that doesn't have 0, but how can I get 1005 from 1500