DEV Community

Discussion on: Much needed filterMap in JavaScript

Collapse
 
alexaegis profile image
AlexAegis

Ideally, filterMap shouldn't restrict me from mapping my elements into anything I could map it to. Including undefined.

[1, 2, 3, 4].filterMap(n => n % 2, n => `${n} is even`)

This would be a better Api, really similar to a separate filter and map, but with one loop inside.