Array.reverse() : Reverse « Array « JavaScript Tutorial






The reverse() method reverses the order of the elements in the array according to the array index numbers.

<html>
    <script language="JavaScript">
    <!--
    lineOfPeople = new Array("A","B","C");
    lineOfPeople.reverse();
    document.write("lineOfPeople[0]=",lineOfPeople[0],"<br>");
    document.write("lineOfPeople[1]=",lineOfPeople[1],"<br>");
    document.write("lineOfPeople[2]=",lineOfPeople[2],"<br>");
    -->
    </script>
</html>








11.25.Reverse
11.25.1.Array.reverse()
11.25.2.Reverse the elements in an Array