Travis build: 902

This commit is contained in:
Travis CI
2018-01-03 11:47:41 +00:00
parent d73740ba54
commit b2be168e86
3 changed files with 13 additions and 10 deletions

View File

@ -7,12 +7,12 @@ You can omit `start` to use a default value of `0`.
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);
const initializeArrayWithRange = (end, start = 0, step = 1) =>
Array.from({ length: Math.ceil((end + 1 - start) / step) }).map((v, i) => i * step + start);
```
```js
initializeArrayWithRange(5); // [0,1,2,3,4,5]
initializeArrayWithRange(7, 3); // [3,4,5,6,7]
initializeArrayWithRange(9,0,2); //[0,2,4,6,8]
initializeArrayWithRange(9, 0, 2); //[0,2,4,6,8]
```