reverse()

Takes an array (or an array-like object) or a string, copies it, and returns the copy in reverse order.

This function is valid in v2.10.2 to v2.13.3. This function has been downloaded 33 times.

Parameter

{Array|string} arrOrStr
If this is an array or an array-like object a copy of it will be made as an array and then the copy will be reversed. If this is a string a copy will be made with all of the characters put in reverse order.

Returns

{Array|string}
Returns a copy of arrOrStr in reverse order.

Required Function

This function requires the following function which is included automatically:

  • slice()
    Slice does not modify the original array, but instead returns a shallow copy of elements from the original array.