Skip to content

unshift

Subhajit Sahu edited this page Mar 14, 2020 · 22 revisions

Adds values to the start.

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

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

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

references

Clone this wiki locally