The reverse() Function is used to reverse a Array. It is independent of the alphabets or numbers.
And is not a sort. It is just a reversal.
<html> <body> <script> var x = ["Mohan", "Kriti", "Salim"] x.reverse() document.write("The Array in reversed order is [",x,"]") </script> </body> </html>
So, in the above code we have created a Array and initialised to the variable x.
x = ["Mohan", "Kriti", "Salim"]
Below is how the values are positioned in the Array,
Then we have used the reverse() Function to reverse the elements of the Array x.
x.reverse()
And the Array x gets sorted in descending order with Salim as the first value, Mohan second and Kriti as the third.
And we get the below output.
The Array in reversed order is ['Salim', 'Kriti', 'Mohan']