Skip to content

unshift

Subhajit Sahu edited this page Feb 3, 2021 · 21 revisions

Adds values to the start. 🏃 📼 📦 🌔 📒

Similar: push, pop, shift, unshift.


iterable.unshift(x, ...vs);
// x:  an iterable
// vs: values to add
const iterable = require("extra-iterable");

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

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


References

Clone this wiki locally