Searches an array for all positions of a specified value. The function searches for simple values such as strings and numbers or for complex objects such as structures. When the second parameter is a simple value, string searches are case-sensitive
arrayFindAll(array, value or callback)
→ returns array
someArray.findAll(value or callback)
courses = [{
name: "Getting started with ColdFusion",
participants: []
},{
name: "Caching in ColdFusion",
participants: [{
name: "John Doe",
age: 45
},{
name: "Jane Doe",
age: 46
}]
},{
name: "Changeover to Lucee",
participants: []
},{
name: "Update ColdFusion",
participants: [{
name: "Arthur Dent",
age: 42
}]
}];
chosenCourses = arrayFindAll(courses,function(course) {
return arrayLen(course.participants);
});
writeOutput(ArrayToList(chosenCourses));
Expected Result: 2,4
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.