-
Notifications
You must be signed in to change notification settings - Fork 5
fill$
Subhajit Sahu edited this page May 3, 2023
·
19 revisions
Fill with given value!
function fill$(x, v, i, I)
// x: an array (updated!)
// 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 ]
x;
// → [ 2, 2, 2, 2 ]
var x = [1, 2, 3, 4];
xarray.fill$(x, 2, 1);
// → [ 1, 2, 2, 2 ]
var x = [1, 2, 3, 4];
xarray.fill$(x, 2, 1, 3);
// → [ 1, 2, 2, 4 ]