New in Formulas 2.0
The reverse()
function will reverse the items in a list.
reverse(list)
list.reverse()
Code language: JavaScript (javascript)
If you require reverse sorting, simply sort the list first before reversing.
[1, 5, 4, 3, 2].reverse() /* Output: [2, 3, 4, 5, 1] */
[1, 5, 4, 3, 2].sort().reverse() /* Output: [5, 4, 3, 2, 1] */
Code language: JavaScript (javascript)
Example Formulas
reverse(["Luffy", "Zoro", "Nami", "Chopper"])
/* Output: ["Chopper", "Nami", "Zoro", "Luffy"] */
Code language: JavaScript (javascript)