programming-examples/js/String/Alphabetize a given string.js
2019-11-15 12:59:38 +01:00

7 lines
156 B
JavaScript

function alphabetize_string(str)
{
return str.split('').sort().join('').trim();
}
console.log(alphabetize_string('United States'));