Skip to content

Instantly share code, notes, and snippets.

@fzn0x
Last active August 16, 2020 04:50
Show Gist options
  • Save fzn0x/6c504068c0e414676567ffe3031a5c6c to your computer and use it in GitHub Desktop.
Save fzn0x/6c504068c0e414676567ffe3031a5c6c to your computer and use it in GitHub Desktop.
Divide And Sort Javascript
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));
@fzn0x
Copy link
Author

fzn0x commented Aug 13, 2020

This code was delivered to a question on https://t.me/js_id
photo_2020-08-13_22-44-55
Telegram Group

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment