A javascript library for working with objects
Returns an array of specified length filled with either the index value or the value returned from the provided callback.
Param | Type | Description |
---|---|---|
length | number |
The desired length of the returned array. |
[callback] | function |
Provides one argument, the index of the returned array. |
Example
import { fill } from 'object-agent';
fill(5);
// => [0, 1, 2, 3, 4]
fill(3, (index) => index * 3);
// => [0, 3, 6]