Used to iterate over an array and run the function closure for each item in the array.
arrayEach(array, function(item, [index, [array]]){} [, parallel] [, maxThreads])
→ returns void
someArray.each(function(item, [index, [array]]){} [, parallel] [, maxThreads])
value
*
any
:
The value for the current iteration
index
*
numeric
:
The current index for the iteration
array
*
array
:
A reference of the original array
false
20
letters = ["a","b","c","d"];
arrayEach(letters, function(element,index) {
writeOutput("#index#:#element#;");
});
Expected Result: 1:a;2:b;3:c;4:d;
a = ["a","b","c"];
a.each(function(element,index,array){
writeOutput("#index#:#element#;");
});
Expected Result: 1:a;2:b;3:c;
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.