sortCharactersInString
Alphabetically sorts the characters in a string.
- Use the spread operator (
...),Array.prototype.sort()andString.prototype.localeCompare()to sort the characters instr. - Recombine using
String.prototype.join('').
Alphabetically sorts the characters in a string.
...), Array.prototype.sort() and String.prototype.localeCompare() to sort the characters in str.String.prototype.join('').