Hint
flatMap = map + flat(1). Perfect when each element produces multiple values.
const sentences = ['hello world', 'foo bar'];
const words = sentences.flatMap(s => s.split(' '));
console.log(words.length);
console.log(words[1]);4 world
Explanation: flatMap maps to arrays then flattens one level. ["hello","world"] + ["foo","bar"] → 4 words.
Key Insight: flatMap = map + flat(1). Perfect when each element produces multiple values.