Answers for "sort letter javascript"

4

javascript sort chars in string

const sort = str => str.split('').sort((a, b) => a.localeCompare(b)).join('');

// Example
sort('hello world');    // dehllloorw
Posted by: Guest on July-03-2020
1

string sort javascript

var names = ["Peter", "Emma", "Jack", "Mia"];
var sorted = names.sort(); // ["Emma", "Jack", "Mia", "Peter"]
Posted by: Guest on May-21-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language