UNPKG

@extra-array/reverse

Version:
49 lines (36 loc) 1.59 kB
Reverses the array. [:package:](https://www.npmjs.com/package/@extra-array/reverse) [:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array) [:running:](https://npm.runkit.com/@extra-array/reverse) [:vhs:](https://asciinema.org/a/332117) [:moon:](https://www.npmjs.com/package/@extra-array/reverse.min) [:scroll:](https://unpkg.com/@extra-array/reverse/) [:newspaper:](https://nodef.github.io/extra-array/) [:blue_book:](https://github.com/nodef/extra-array/wiki/) > Alternatives: [reverse], [reverse$].<br> > Similar: [repeat], [cycle], [rotate], [reverse]. > This is part of package [extra-array]. [extra-array]: https://www.npmjs.com/package/extra-array <br> ```javascript array.reverse(x); // x: an array ``` ```javascript const array = require("extra-array"); var x = [1, 2, 3, 4]; array.reverse(x); // [ 4, 3, 2, 1 ] ``` <br> <br> ## References - [Array.prototype.reverse: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse) - [Collections.reverse: Java](https://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#reverse(java.util.List)) - [_.reverse: lodash](https://lodash.com/docs/4.17.15#reverse) - [immutable-array-prototype: @azu](https://github.com/azu/immutable-array-prototype) [reverse]: https://github.com/nodef/extra-array/wiki/reverse [reverse$]: https://github.com/nodef/extra-array/wiki/reverse$ [repeat]: https://github.com/nodef/extra-array/wiki/repeat [cycle]: https://github.com/nodef/extra-array/wiki/cycle [rotate]: https://github.com/nodef/extra-array/wiki/rotate