Iterators interview questions
Practice 4 questions on iterators. Each runs in a real in-browser editor with Jest tests and a worked, diagram-backed solution.
4 questions
- EASY
Cycle
Implement a function that, given several values, returns a function that yields each one in turn and loops forever.
15 minJavaScript - MEDIUM
Array.fromAsync
Implement Array.fromAsync: build a promise of an array from a sync or async iterable, awaiting each value in order.
30 minJavaScript - MEDIUM
Iterator Helpers
Build lazy, chainable iterator helpers — map, filter, take, drop, and flatMap — that pull one value at a time.
35 minJavaScript - MEDIUM
String replaceAll / matchAll
Implement replaceAll and matchAll — replace every occurrence of a substring or global pattern, and iterate every match with its capture groups.
35 minJavaScript