-
Notifications
You must be signed in to change notification settings - Fork 5
unshift$
Subhajit Sahu edited this page May 3, 2023
·
15 revisions
Add values to the start!
Alternatives: unshift, unshift$.
Similar: push, pop, shift, unshift.
function unshift$(x, ...vs)
// x: an array (updated!)
// vs: values to add
const xarray = require('extra-array');
var x = [3, 4];
xarray.unshift$(x, 2);
// → [ 2, 3, 4 ]
x;
// → [ 2, 3, 4 ]
var x = [3, 4];
xarray.unshift$(x, 1, 2);
// → [ 1, 2, 3, 4 ]