Update initializeArrayWithRange sinppets

Array.from(arrayLike[, mapFn[, thisArg]]) instand of  `Array.map()` to fill with the desired values in a range
This commit is contained in:
浪浪浪
2018-08-13 09:36:54 +08:00
committed by GitHub
parent a5dc1a2592
commit 30b17c9b7b

View File

@ -8,7 +8,7 @@ You can omit `step` to use a default value of `1`.
```js
const initializeArrayWithRange = (end, start = 0, step = 1) =>
Array.from({ length: Math.ceil((end + 1 - start) / step) }).map((v, i) => i * step + start);
Array.from({length: Math.ceil((end - start + 1) / step)}, (v, i) => i * step + start);
```
```js