Skip to content

unshift$

wolfram77 edited this page Apr 11, 2020 · 15 revisions

Adds values to the start. 🏃 📦 🌔

Alternatives: default, update.
Similar: push, pop, shift, unshift.

array.unshift$(x, ...vs);
// x:  an array (updated)
// vs: values to add
// --> x
const array = require('extra-array');

var x = [3, 4];
array.unshift$(x, 2);
// [ 2, 3, 4 ]

x;
// [ 2, 3, 4 ]

var x = [3, 4];
array.unshift$(x, 1, 2);
// [ 1, 2, 3, 4 ]

references

Clone this wiki locally