collectionEach

Iterate over each item contained in the collection given

collectionEach(collection, closure) → returns void

This function requires Lucee. Not supported on Adobe ColdFusion.

collectionEach Argument Reference

collection any
Required

closure function
Required

Examples sample code invoking the collectionEach function


Iterate over collection and output a key from each item

coll = [{
    id: 0,
    name: 'me'
},{
    id: 1,
    name: 'you'
}];
collectionEach(coll,function(item) {
    writeOutput(item.name);
    writeOutput(' - ');
});

Expected Result: me - you -


Fork me on GitHub