Travis build: 1041
This commit is contained in:
@ -5,10 +5,7 @@ Alphabetically sorts the characters in a string.
|
||||
Use the spread operator (`...`), `Array.sort()` and `String.localeCompare()` to sort the characters in `str`, recombine using `String.join('')`.
|
||||
|
||||
```js
|
||||
const sortCharactersInString = str =>
|
||||
[...str]
|
||||
.sort((a, b) => a.localeCompare(b))
|
||||
.join('');
|
||||
const sortCharactersInString = str => [...str].sort((a, b) => a.localeCompare(b)).join('');
|
||||
```
|
||||
|
||||
```js
|
||||
|
||||
Reference in New Issue
Block a user