array.map()

Calls the given closure with every element in the given array.

the function returns an array that contains all values returned by the closure.

array.map( closure=function, parallel=boolean, maxThreads=number )

Returns: Array

Argument Description
closure
function, required

filter can be a function/closure that implements the following constructor

[function(any value[, number index, array array]):any].

Alias: function, callback, udf

parallel
boolean, optional

execute closures parallel

maxThreads
number, optional

maximum number of threads executed, ignored when argument "parallel" is set to false

Examples

aNames = ["Marcus","Sarah","Josefine"];
	writedump(aNames);
	newNames2 = aNames.map(function(item,index,arr){
	    return {'name':item};
	});
	writedump(newNames2);

See also