arrayMax

Returns the largest numeric value in an array. If the array
parameter value is an empty array, returns zero.
All elements must contain values that can be automatically
converted to numeric values.

arrayMax(array) → returns numeric

Member Function Syntax

someArray.max()

Argument Reference

array array
Required

An array or variable name

Examples
Sample code invoking the arrayMax function

To get the largest numeric value of an array

someArray = arrayNew(1);
writeOutput(arrayMax(someArray));

Expected Result: 0

Uses the arrayMax function to get the largest numeric value of an array

someArray = [23,45,87,1,4];
writeOutput(arrayMax(someArray));

Expected Result: 87

CF 11+ Lucee 4.5+

someArray = [23,45,0,1,4];
writeOutput(someArray.max());

Expected Result: 45

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub