ArrayReverse

Returns an array with all of the elements reversed.

The value in [0] within the input array will then exist in [n] in the output array, where n is the amount of elements in the array minus one.

Method Signature

ArrayReverse(array=[array])

Arguments

Argument
Type
Required
Description
Default

array

array

true

The array to reverse

Examples

Reverse an Array

Creates a new array with reversed positions

Run Example

myArray = [ 
	1,
	2,
	3
];
myArrayReversed = arrayReverse( myArray );
writeOutput( JSONSerialize( myArrayReversed ) );

Result: [3,2,1]

Reverse an Array via Member Function

Run Example

Result: [3,2,1]

Reverse an Array using array slice syntax

Reverse an Array using array slice syntax adding in Boxlang 2018

Result: [3,2,1]

Additional Examples

Run Example

Last updated

Was this helpful?