arrayFirst

Returns the first item from an array.

arrayFirst(array) → returns any

Member Function Syntax

array.first()

This function requires Lucee. Not supported on Adobe ColdFusion.

arrayFirst Argument Reference

array
Required

Examples sample code invoking the arrayFirst function


Member Function

Use the member function to return the first item from an array

someArray = [1,2,3,4];
WriteOutput(someArray.first());

Expected Result: 1


Non-Member Function

Return the first item from an array

seinfeldArray = ["Jerry","Elaine","Kramer","George"];
WriteOutput(arrayFirst(seinfeldArray));

Expected Result: "Jerry"


Fork me on GitHub