Update initializeArrayWithRange.md

This commit is contained in:
Rohit Tanwar
2018-01-03 13:11:37 +05:30
committed by GitHub
parent dde371f8f9
commit c9e46a1431

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(Math.ceil((end + 1 - start)/2)).fill(0).map((v, i) => (i * step) + start);
Array.from({length:Math.ceil((end + 1 - start)/2))}).map((v, i) => (i * step) + start);
```
```js