Calls a given closure/function with every element in a given array and returns true if one of the closure calls returns true
arraySome(array, function(item [,index, array]){} [, parallel] [, maxThreads])
→ returns boolean
someArray.some(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
20
// Create an array
arrayList = ["apple", "pineapple", "mango", "apricot"];
// Match some
result = arraySome(arrayList, function(fruit) {
return fruit.startsWith("a");
});
// Print result
writeOutput((result ? "Some" : "No") & " matches were found!");
Expected Result: Some matches were found!
// Create an array
arrayList = ["apple", "pineapple", "mango", "apricot"];
// Match some
result = arrayList.some(function(fruit) {
return fruit.endsWith("a");
});
// Print result
writeOutput((result ? "Some" : "No") & " matches were found!");
Expected Result: No matches were found!
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.