Files
30-seconds-of-code/snippets/reverse-string.md
Stefan Feješ b848906fe5 fix naming
2017-12-17 15:41:31 +01:00

10 lines
283 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
const reverseString = str => [...str].reverse().join('');
// reverseString('foobar') -> 'raboof'
```