Prev Demo
JavaScript
>
Reversing Elements
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <p>Click the below button to reverse the order of element.</p> <input type="button" onclick="myValue()" value="Reverse"/> <p id="myId"></p> <script> function myValue() { var a = ["France", "Egypt", "Darziling", "China", "Bangladesh", "Abudhabi"]; var b = a.reverse(); document.getElementById("myId").innerHTML = b; } </script> </body> </html>
Note: We DO NOT save your trial code in our database.
Output