Files
30-seconds-of-code/snippets/reverse-a-string.md
2017-12-12 11:27:10 +02:00

9 lines
243 B
Markdown

### 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('');
```