Iterates over every entry of the List and calls the closure function to work on the item of the list. The returned value will be set at the same index in a new list and the new list will be returned.

listMap(list, function(item [,index, list]) [,delimiter, includeEmptyFields) → returns String

Argument Reference for the listMap function


Required: Yes
The input list.


Required: Yes
Closure or a function reference that will be called for each of the iteration. The arguments passed to the callback are

item: value
index : current index for the iteration
list : reference of the original list


Required: No
Initial value which will be used for the reduce operation.


Required: No
Default: comma
The list delimiter.


Required: No
Default: false
Include empty values

Links more information about listMap

Examples sample code invoking the listMap function

Script Syntax

Rainbow = "Whero, Karaka, Kowhai, Kakariki, Kikorangi, Tawatawa, Mawhero"; 
 externalList = ""; 
 reverseRainbow = listMap( rainbow, function(v,i,l) 
 var newValue = "#i#:#v.reverse()#";  
 externalList = externalList.append(newValue); 
 return newValue; 

Fork me on GitHub