-
Notifications
You must be signed in to change notification settings - Fork 1
fill
Subhajit Sahu edited this page May 10, 2020
·
23 revisions
Fills with given value. 🏃 📼 📦 🌔
iterable.fill(x, v, [i], [I]);
// x: an iterable
// v: value
// i: start index (0)
// I: end index (end)
const iterable = require('extra-iterable');
var x = [1, 2, 3, 4];
[...iterable.fill(x, 2)];
// [2, 2, 2, 2]
[...iterable.fill(x, 2, 1)];
// [1, 2, 2, 2]
[...iterable.fill(x, 2, 1, 3)];
// [1, 2, 2, 4]