reverse

reverse([inline = true]) -> Array

Returns the reversed version of the array. By default, directly reverses the original. If inline is set to false, uses a clone of the original array.

Example

var nums = [3, 5, 6, 1, 20];
nums.reverse(false)
// -> [20, 1, 6, 5, 3]
nums
// -> [3, 5, 6, 1, 20]

nums.reverse()
// -> [20, 1, 6, 5, 3]
nums
// -> [20, 1, 6, 5, 3]