Additional snippets

This commit is contained in:
Angelos Chalaris
2017-11-30 19:12:13 +02:00
parent 292aad75bc
commit bb40a7ec08
9 changed files with 113 additions and 0 deletions

View File

@ -1,8 +0,0 @@
### 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('');
```