update snippets 32-47
This commit is contained in:
committed by
Agamemnon Zorbas
parent
014a77224c
commit
1c73c70b4a
@ -6,6 +6,9 @@ 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.
|
||||
|
||||
```js
|
||||
const digitize = n => [...'' + n].map(i => parseInt(i));
|
||||
// digitize(2334) -> [2, 3, 3, 4]
|
||||
const digitize = n => [...''+n].map(i => parseInt(i));
|
||||
```
|
||||
|
||||
```js
|
||||
differenceWith([1, 1.2, 1.5, 3], [1.9, 3], (a,b) => Math.round(a) == Math.round(b)) // [1, 1.2]
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user