Last active
August 16, 2020 04:50
-
-
Save fzn0x/6c504068c0e414676567ffe3031a5c6c to your computer and use it in GitHub Desktop.
Divide And Sort Javascript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function divideAndSort(value){ | |
const division = value.toString().split("0"); | |
for(let num in division){ | |
if(division[num] == "") { | |
division.splice(num,1); | |
}else{ | |
division[num] = division[num].split("").sort().join().replace(/,/g,""); | |
} | |
} | |
//delete optional code for object value | |
return division.join().replace(/,/g,""); | |
} | |
console.log(divideAndSort(1265738201728278)); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This code was delivered to a question on https://t.me/js_id

Telegram Group