If using ES6, use template litorals
Probably being pernickety. But if we're using ES6, you could just use a template litoral instead of string concat? Not sure if the litoral version is a bit more difficult to read mind you.
This commit is contained in:
@ -6,7 +6,7 @@ Convert the number to a string, using spread operators in ES6(`[...string]`) bui
|
|||||||
Use `Array.map()` and `parseInt()` to transform each value to an integer.
|
Use `Array.map()` and `parseInt()` to transform each value to an integer.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const digitize = n => [...('' + n)].map(i => parseInt(i));
|
const digitize = n => [...(`${n}`)].map(i => parseInt(i));
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
Reference in New Issue
Block a user