UNPKG

@extra-array/shift

Version:
51 lines (37 loc) 1.42 kB
Removes first value. [:package:](https://www.npmjs.com/package/@extra-array/shift) [:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array) [:running:](https://npm.runkit.com/@extra-array/shift) [:vhs:](https://asciinema.org/a/332128) [:moon:](https://www.npmjs.com/package/@extra-array/shift.min) [:scroll:](https://unpkg.com/@extra-array/shift/) [:newspaper:](https://nodef.github.io/extra-array/) [:blue_book:](https://github.com/nodef/extra-array/wiki/) > Alternatives: [shift], [shift$].<br> > Similar: [push], [pop], [shift], [unshift]. > This is part of package [extra-array]. [extra-array]: https://www.npmjs.com/package/extra-array <br> ```javascript array.shift(x); // x: an array ``` ```javascript const array = require("extra-array"); var x = [1, 2, 3]; array.shift(x); // [2, 3] var x = [1, 2, 3, 4]; array.shift(x); // [2, 3, 4] ``` <br> <br> ## References - [Array.prototype.shift: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/shift) - [immutable-iterable-prototype: @azu](https://github.com/azu/immutable-iterable-prototype) [shift]: https://github.com/nodef/extra-array/wiki/shift [shift$]: https://github.com/nodef/extra-array/wiki/shift$ [push]: https://github.com/nodef/extra-array/wiki/push [pop]: https://github.com/nodef/extra-array/wiki/pop [unshift]: https://github.com/nodef/extra-array/wiki/unshift