Skip to content

How to reverse array in JavaScript? #20100

Discussion options

You must be logged in to vote

Hi, kala.
Why don't you use reverse() function in javascript like follows:

const array = ["car", "tank", "port", "airplane"].

const reverse_array = array.reverse().map((array) => {return array}).

Thank you.

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@PhantomGuru0427
Comment options

Answer selected by PhantomGuru0427
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@edward795
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Codespaces Your development environment, in the cloud. Run VS Code and code on GitHub's cloud platform, Product Feedback
4 participants