The reverse() method used to reverse the order of the elements in an array.
Code:-
- <html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- </head>
- <body>
- <h1>reverse()</h1>
- <h1>ar = ["G","X","Q","A","Z","B"]</h1>
- <input type="button" onclick="ar_rev();" value="Inserted Array Values">
- <script>
- function ar_rev()
- {
- var ar = ["G", "X", "Q", "A", "Z", "B"];
- alert("Actual : " + ar);
- alert("Reveresed Array : " + ar.reverse());
- }
- </script>
- </body>
- </html>
Array reverse :- JavaScript
Reviewed by Network security
on
August 06, 2019
Rating:
No comments: