JavaScript Array reverse() method

The JavaScript array reverse() method is used to reverse the elements of given array.

Syntax:

array.reverse()

Return:
Original array with elements in reverse order.

Example:

<!DOCTYPE html>
<html>
<body>
<script>  
var a = ["GOLD","SILVER","DIAMOND","RUBY","PLATINUM"]
var rev_a =a.reverse();  
document.writeln(rev_a);  
</script>  
</body>
</html>

Output:

PLATINUM,RUBY,DIAMOND,SILVER,GOLD
Please Share