TypedArray reverse() JavaScript

The Javascript TypedArray reverse() method reverses an array based on the index.

Syntax:

array.reverse()

Returns:
It returns the reversed array.

Example 1:

<!DOCTYPE html>
<html>
<body>
<script type="text/javascript">   
var Jewels = ["DIAMOND","GOLD","PLATINUM","SILVER"];
var gems = Jewels.reverse();  
document.write(gems);  
</script>
</body>
</html>

Example 2:

<!DOCTYPE html>
<html>
<body>
<script type="text/javascript"> 
const testArray = new Uint8Array([21, 42, 53]);
testArray.reverse();
 
document.write(testArray);
 
</script>
</body>
</html>