Merge pull request #12 from fejes713/master

Add reverseString
This commit is contained in:
Angelos Chalaris
2017-12-12 11:25:35 +02:00
committed by GitHub

View File

@ -263,7 +263,7 @@ var objectFromPairs = arr =>
### Powerset
Use `reduce()` combined with `map()` to iterate over elements and combine into an array containing all combinations.
Use `reduce()` combined with `map()` to iterate over elements and combine into an array containing all combinations.
```js
var powerset = arr =>
@ -296,6 +296,14 @@ var redirect = (url, asLink = true) =>
asLink ? window.location.href = url : window.location.replace(url);
```
### Reverse a string
Use `reverse()` to reverse order of elements in `destructed` array. Combine elements to get a string using `join('')`.
```js
var reverseString = str => [...str].reverse().join('');
```
### RGB to hexadecimal
Convert each value to a hexadecimal string, using `toString(16)`, then `padStart(2,'0')` to get a 2-digit hexadecimal value.