10 lines
325 B
Markdown
10 lines
325 B
Markdown
### Initialize array with range
|
|
|
|
Use `Array(end-start)` to create an array of the desired length, `map()` to fill with the desired values in a range.
|
|
You can omit `start` to use a default value of `0`.
|
|
|
|
```js
|
|
var initializeArrayRange = (end, start = 0) =>
|
|
Array.apply(null, Array(end-start)).map( (v,i) => i + start );
|
|
```
|