|
| |
Changing the elements of an array |
We can reverse the order of the element by using the reverse method. Here the first element will became last method and last element became first.
Here is the code to reverse the array elements.
<script type="text/javascript"> var scripts = new Array(); scripts[0] = "PHP"; scripts[1] = "ASP"; scripts[2] = "JavaScript"; scripts[3] = "HTML"; document.write(scripts.join(" <br> ")); document.write("<br>----<br>"); scripts.reverse(); document.write(scripts.join(" <br> ")); </script>
| |
| Subscribe |
|
Submit your email address and receive
article and product notifications. Your email is safe with us.
|
|
|
|