-
Notifications
You must be signed in to change notification settings - Fork 5
set
Subhajit Sahu edited this page Mar 14, 2020
·
26 revisions
Sets value at index (+ve, -ve).
array.set(x, i, v);
// x: an array
// i: index (-ve: from right)
// v: value
// --> set array
const array = require('extra-array');
var a = [2, 4, 6, 8];
array.set(a, 0, -2);
// [-2, 4, 6, 8]
array.set(a, 1, -4);
// [2, -4, 6, 8]
array.set(a, -1, -8);
// [2, 4, 6, -8]