-
Notifications
You must be signed in to change notification settings - Fork 1
fill
Subhajit Sahu edited this page Feb 3, 2021
·
23 revisions
Fill with given value.
function fill(x, v, i, I)
// x: an iterable
// v: value
// i: start index [0]
// I: end index [END]
const xiterable = require('extra-iterable');
var x = [1, 2, 3, 4];
[...xiterable.fill(x, 2)];
// → [2, 2, 2, 2]
[...xiterable.fill(x, 2, 1)];
// → [1, 2, 2, 2]
[...xiterable.fill(x, 2, 1, 3)];
// → [1, 2, 2, 4]