const sort = str => str.split('').sort((a, b) => a.localeCompare(b)).join(''); // Example sort('hello world'); // dehllloorw
const sort = arr => arr.sort((a, b) => a - b); //By default,the sort() function sorts values as strings.Fix this by providing a compare function. // Example sort([1, 5, 2, 4, 3]); // [1, 2, 3, 4, 5]