updating function to use spread operator to make it more ES6ish

This commit is contained in:
iamsoorena
2017-12-17 01:25:03 +03:30
parent abfd68b38b
commit 53d6c91b5e

View File

@ -4,6 +4,6 @@ Convert the number to a string, use `split()` to convert build an array.
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).split('').map(i => parseInt(i)); const digitize = n => [...''+n].map(i => parseInt(i));
// digitize(2334) -> [2, 3, 3, 4] // digitize(2334) -> [2, 3, 3, 4]
``` ```