Skip to content

unshift

wolfram77 edited this page Apr 11, 2020 · 22 revisions

Adds values to the start. 🏃 📦 🌔

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

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

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

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

references

Clone this wiki locally