óCoffeeScript Cookbook

Reversing Arrays

Problem

You want to reverse an array.

Solution

Use JavaScript’s Array reverse() method:

["one", "two", "three"].reverse()
# => ["three", "two", "one"]

Discussion

reverse() is a standard JavaScript method. Don’t forget the parentheses.