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