how can i compare 2 strings by alphabetical order in javascript code example
Example: javascript compare and sort strings alphabetically
function sortString(str){
var arr = str.split('');
var sorted = arr.sort();
return sorted.join('');
}Copy