Answers for "javascript sort strings by length and alphabetically"

10

js sort alphabetically

users.sort((a, b) => a.firstname.localeCompare(b.firstname))
Posted by: Guest on October-19-2020
-1

javascript compare and sort strings alphabetically

function sortString(str){
  var arr = str.split('');
  var sorted = arr.sort();
  return sorted.join('');
}Copy
Posted by: Guest on February-29-2020

Code answers related to "javascript sort strings by length and alphabetically"

Code answers related to "Javascript"

Browse Popular Code Answers by Language