Array reverse()
In this chapter you will learn:
reverse():Reordering array
reverse()
method reverses the order of items in an array.
<!DOCTYPE html><!-- j av a 2s .c om-->
<html>
<head>
<script type="text/javascript">
var values = [1, 2, 3, 4, 5];
values.reverse();
document.writeln(values); //5,4,3,2,1
</script>
</head>
<body>
</body>
</html>
reverse()
returns a reference to the resulting array.
Next chapter...
What you will learn in the next chapter:
Home » Javascript Tutorial » Array