JavaScript Array reverse()

The JavaScript array reverse() method is used to reverse the elements of the 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>
Please follow and like us:
Content Protection by DMCA.com