fix naming
This commit is contained in:
@ -1,10 +0,0 @@
|
||||
### Initialize array with range
|
||||
|
||||
Use `Array(end-start)` to create an array of the desired length, `Array.map()` to fill with the desired values in a range.
|
||||
You can omit `start` to use a default value of `0`.
|
||||
|
||||
```js
|
||||
const initializeArrayRange = (end, start = 0) =>
|
||||
Array.from({ length: end - start }).map((v, i) => i + start);
|
||||
// initializeArrayRange(5) -> [0,1,2,3,4]
|
||||
```
|
||||
Reference in New Issue
Block a user