Description
Used to loop over an array.
Returns
Nothing
Category
Syntax
arrayEach(array,function(any currentObj) {});
See also
Other array functions.
History
ColdFusion 11: Passing array index to callback functions.
ColdFusion 10: Added this function.
Parameters
Parameter |
Description |
---|---|
array |
Name of the array object. |
function |
Callback executed for each element in the array. |
Passing array index to callback functions in ArrayEach
ColdFusion 10 supported passing objects in a callback function. In ColdFusion 11, you could pass the index of an array to the callback function as shown below:
|
Also, the original array can also be passed to the closure function. So the following code is also valid:
function printArrayCity(city, index, cityArray) |