Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js order string

// function that returns a string in alphabetical order
function reorderStr(str) {
	return [...str].sort().join('');
}
console.log(reorderStr("hacker"));	//"acehkr"
console.log(reorderStr("javascript"));//"aacijprstv"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #order #string
ADD COMMENT
Topic
Name
9+9 =