fill(value, start = 0, end = Enumerable length)
Fills all the elements of an Enumerable from a start index to an end index with a static value. This is the equivalent of Array.prototype.fill
Arguments
- value (any): value to fill the Enumerable.
- start (Number): start index.
- end (Number): end index.
Returns
(Enumerable): New filled Enumerable.
Example
Enumerable
.from([1, 2, 3])
.fill(4)
.toArray();
// [4, 4, 4]
Enumerable
.from([1, 2, 3])
.fill(4, 1)
.toArray();
// [1, 4, 4]
Enumerable
.from([1, 2, 3])
.fill(4, 1, 2)
.toArray();
// [1, 4, 3]