Updated string reversal

This commit is contained in:
Angelos Chalaris
2017-12-12 11:27:10 +02:00
parent 32b178580e
commit 54daad2b70
2 changed files with 13 additions and 3 deletions

View File

@ -0,0 +1,8 @@
### Reverse a string
Use array destructuring and `Array.reverse()` to reverse the order of the characters in the string.
Combine characters to get a string using `join('')`.
```js
var reverseString = str => [...str].reverse().join('');
```