arrayLast

Returns the first item from an array. Throws an error if the array is empty.

arrayLast(array) → returns any

Member Function Syntax

array.last()

This function requires Lucee. Not supported on Adobe ColdFusion.

arrayLast Argument Reference

array
Required

Examples sample code invoking the arrayLast function


Show the last element of an array

Uses the arrayLast function to retrieve the last element of an array

someArray = [1,2,3];
lastOne=arrayLast(someArray);
writeOutput(lastOne);

Expected Result: 3


Fork me on GitHub