Reverse Elements In An Array

 
 
The reverse() method is used to reverse the order of the elements in an array.
 
 
  1. <script type="text/javascript">

  2.  

  3. var arr = new Array(3);

  4. arr[0] = "Jani";

  5. arr[1] = "Hege";

  6. arr[2] = "Stale";

  7.  

  8. document.write(arr+"<br />");

  9. document.write(arr.reverse());

  10.  

  11. </script>
 
Copy to Clipboard      Download code as Text Format
 
  Date entered : 25th Mar 2008
  Rating : No Rating
  Accessed  :  461
  Submitted by :  goldeekhan
 
   Add Comment  Printer friendly
   View All Comments  Email to a friend
   Add to my Favourites Download PDF version
   Rating  
 
                 Click each image to add
this page to each site.
 
 
 
Comments Available

    No comment available at the moment.Be the first one to make a comment

 
Related JavaScript Source Codes
  • Spring
  • Wraps a string to a given number of characters using a string break character
  • Uppercase the first character of each word in a string
  • Make a string's first character uppercase
  • Strip whitespace (or other characters) from the beginning and end of a string

  • Copyright © 2013 VisualBuilder. All rights reserved