Iterates over every entry of the array and calls the closure function to work on the element of the array. The returned value will be set at the same index in a new array and the new array will be returned
arrayMap(array, function(item [,index, array]){} [, parallel] [, maxThreads])
→ returns array
someArray.map(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
false
true
false
20
complexData = [ {a: 4}, {a: 18}, {a: 51} ];
newArray = arrayMap( complexData, function(item){
return item.a;
});
writeDump(newArray);
Expected Result: [4, 18, 51]