JavaScript · Senior · Question 52 of 75
What do iterator helpers like map.values().filter(...).take(3) give you?
- ✓Correct answer: Lazy, chainable operations on any iterator without first materializing an array
- 2Faster array methods
- 3Parallel iteration on multiple threads
Explanation
Iterator.prototype gained map, filter, take, drop, flatMap, reduce, toArray and more. They process items on demand, so take(3) on a huge or infinite generator stops early.