First snippet, builder working

This commit is contained in:
Angelos Chalaris
2017-11-30 17:40:06 +02:00
parent 12c0f19b4c
commit ba784f314b
9 changed files with 1946 additions and 2 deletions

View File

@ -0,0 +1,8 @@
### Sort characters in string (alphabetical)
Split the string using `split('')`, `sort()` utilizing `localeCompare()`, recombine using `join('')`.
```js
var sortCharactersInString = str =>
str.split('').sort( (a,b) => a.localeCompare(b) ).join('');
```