Docly Developers
Function Updated 22 Jul 2024

Array.reverse()

The reverse() method reverses an array in place and returns the reference to the same array.

Parameters

This function takes no parameters.

Returns

Returns the array in reverse order. (Also changes the same array)

Example

Mixed HTML (or any text file) with inline JavaScript between hash signs.
#{
    // Init an array with three items
    var arr = ["one", "two", "three"];
    
    // Reverse the order of the items
    arr.reverse();
    
    // Output the array to screen, now reversed
    write(JSON.stringify(arr));
}#