Description

Return a new array from calling an expression for every array element.

Syntax

map(array, element, expression)

Parameters

Input ParameterTypeDescription
arrayArrayThe array map() was called upon
elementanyThe current element being processed in the array
expressionexpressionAn expression to be run for each array element.

Return value

Type
Array<any>

Sample

ExampleResultDescription
map([4, 8], x, x*10)[40, 80]Returns the new mapped array
map([{'name' : 'John', 'age' : 18},{'name' : 'Raj', 'age' : 25}], x, toUpper(x.name))[{'name' : 'JOHN', 'age' : 18},{'name' : 'RAJ', 'age' : 25}]Change all user names to upper case
map(a, x, arraySum(filter(x, y, y>10)))[ 20, 110 ]Apply map with filter function

To view all the List functions, click here.

See Also