Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript sort chars in string

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

// Example
sort('hello world');    // dehllloorw
 
PREVIOUS NEXT
Tagged: #javascript #sort #chars #string
ADD COMMENT
Topic
Name
7+5 =