Arrays & Iterables

Implement Array flatMap

easyJS SpecificJS / TS3 tests

Problem Statement

Implement `myFlatMap(array, callback)` that maps each element using a mapping function, then flattens the result into a new array by one level.

Examples

Example 1:
myFlatMap([1, 2, 3], (x) => [x, x * 2]); // [1, 2, 2, 4, 3, 6]
JavaScript & TypeScript starter code included
Run this as a live interview

Practice solo

3 test cases. No second person needed.

Get new interview exercises

Practice problems and review drills, sent when we publish new ones. No spam.

Unsubscribe anytime. We never share your address.