Objects implementing `[Symbol.iterator]` are iterable. Generator functions (`function*`) yield values lazily on demand.
js
function* blockStream(start, end) {
for (let i = start; i <= end; i++) yield i;
}100 XP to Apprentice
Custom iteration protocols and yield.
AI translates the explanation and quiz text while preserving code and answer scoring.
Objects implementing `[Symbol.iterator]` are iterable. Generator functions (`function*`) yield values lazily on demand.
js
function* blockStream(start, end) {
for (let i = start; i <= end; i++) yield i;
}1. What symbol defines the iterable protocol on an object?
2. What does the yield keyword do inside a generator?
3. Why use generators for paging large datasets?