ArrayMap()
Calls the given closure with every element in the given array.
The function returns an array that contains all values returned by the closure.
ArrayMap( array=array, closure=function, parallel=boolean, maxThreads=number );
Returns: Array
Examples
Modify an array and store it back into the array
Does not modify existing array, creates a new array and stores it to the assigned variable
aNames = ["Marcus","Sarah","Josefine"];
dump(aNames);
newNames1 = arrayMap(aNames,function(item,index,arr){
return {'name':item};
});
dump(newNames1);
//member function
newNames2 = aNames.map(function(item,index,arr){
return {'name':item};
});
dump(newNames2);
See also
- Arrays
- Collections
- Threads
- array.map()
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)