Adds values to the start.
npm install @extra-array/unshift-updateAdds values to the start.
:package:
:smiley_cat:
:running:
:vhs:
:moon:
:scroll:
:newspaper:
:blue_book:
> Alternatives: [unshift], [unshift$].
> Similar: [push], [pop], [shift], [unshift].
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
``javascript`
array.unshift$(x, ...vs);
// x: an array (updated)
// vs: values to add
// → x
`javascript
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 ]
``
- Array.prototype.unshift: MDN web docs
- array_unshift: PHP
- Array.unshift: Ruby
- immutable-iterable-prototype: @azu
[unshift]: https://github.com/nodef/extra-array/wiki/unshift
[unshift$]: https://github.com/nodef/extra-array/wiki/unshift$
[push]: https://github.com/nodef/extra-array/wiki/push
[pop]: https://github.com/nodef/extra-array/wiki/pop
[shift]: https://github.com/nodef/extra-array/wiki/shift