-
Notifications
You must be signed in to change notification settings - Fork 5
fill
Subhajit Sahu edited this page May 3, 2023
·
25 revisions
Fill with given value.
function fill(x, v, i, I)
// x: an array
// v: value
// i: begin index [0]
// I: end index [|x|]
const xarray = require('extra-array');
var x = [1, 2, 3, 4];
xarray.fill(x, 2);
// → [ 2, 2, 2, 2 ]
xarray.fill(x, 2, 1);
// → [ 1, 2, 2, 2 ]
xarray.fill(x, 2, 1, 3);
// → [ 1, 2, 2, 4 ]