Logo

Programming-Idioms

History of Idiom 189 > diff from v8 to v9

Edit summary for version 9 by programming-idioms.org:
[JS] Elements name e

Version 8

2019-09-27, 13:31:59

Version 9

2019-09-27, 14:03:48

Idiom #189 Filter and transform list

Produce a new list y containing the result of function T applied to all elements e of list x that match the predicate P.

Idiom #189 Filter and transform list

Produce a new list y containing the result of function T applied to all elements e of list x that match the predicate P.

Extra Keywords
map apply
Extra Keywords
map apply
Code
y = x.filter(i => P(i)).map(i => T(i))
Code
y = x.filter(e => P(e)).map(e => T(e))