Files
30-seconds-of-code/snippets/reverseString.md
2017-12-17 17:55:51 +02:00

12 lines
300 B
Markdown

### reverseString
Reverses 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'
```