programming-examples/js/String/Alphabetize a given string.js

7 lines
156 B
JavaScript
Raw Normal View History

2019-11-15 12:59:38 +01:00
function alphabetize_string(str)
{
return str.split('').sort().join('').trim();
}
console.log(alphabetize_string('United States'));