Initialize new dimensional array
Create a new multi-dimensional array with initialized values.
Example
let inda = require('inda');
inda(23, 3);
let i = 0;
inda(() => i++), 3);
inda(1, 2, 3);
inda(1, ...inda(1, 12));
inda(() => () => 6, 2);
Installation
$ npm install inda
API
var inda = require('inda');
inda(initialValue, size, ...sizes)
Type | Data Type | Name | Description |
---|
parameter | * | initialValue | A value to each element in the array. If a callback is provided, the returned value will be used. |
parameter | number | size | The size of the array to return. |
parameter | ...number | sizes | The sizes of nested-arrays. |
returns | *[] | | An array of initialized values. |
Links