The reverse() method returns the array in reverse order.
Example
reverse() Syntax
The syntax of the array reverse() method is:
array.reverse()
Here, array is an object of the Array class.
reverse() Parameters
The reverse() method doesn't take any parameters.
max() Return Values
The reverse() method doesn't return any value. It updates the existing array.
Example 1: Swift Array reverse()
Output
Original Array: ["Windows", "macOS", "Linux"] Updated Array: ["Linux", "macOS", "Windows"]
Here, we can see that the reverse() method reverses the order of array elements.