Files
30-seconds-of-code/snippets/reverseString.md
2017-12-28 08:30:19 +00:00

19 lines
323 B
Markdown

### reverseString
Reverses a string.
Use `split('')` 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
.split('')
.reverse()
.join('');
```
```js
reverseString('foobar'); // 'raboof'
```