This is map composed with filter. It doesn't need a name.
map (*3) . filter (>2)
문제
I have an array with some values:
[1, 2, 3, 4]
I'd like to make a new array that contains mapped
version of the items in the array above, but only add them to the new array if they pass a truth test.
A combination of map and filter?
[1, 2, 3, 4].mapFilter(function(n) { if (n > 2) return n * 3 })
What is this called?
해결책
This is map composed with filter. It doesn't need a name.
map (*3) . filter (>2)