Challenge 3 — Solution Task: Write a generator function* idGenerator(prefix) that yields strings like "prefix-1", "prefix-2", "prefix-3", incrementing forever. Create two SEPARATE generators with different prefixes ("user" and "order") and call .next().value three times on each, interleaved, to confirm they don't interfere with each other. function* idGenerator(prefix) { let count = 1; while (true) { yield `${prefix}-${count}`; count++; } } const userIds = idGenerator("user"); const orderIds = idGenerator("order"); console.log(userIds.next().value); console.log(orderIds.next().value); console.log(userIds.next().value); console.log(orderIds.next().value); console.log(userIds.next().value); console.log(orderIds.next().value); Expected output: user-1 order-1 user-2 order-2 user-3 order-3 Notes: - userIds and orderIds are two completely separate generator instances, each created by its own call to idGenerator — each one has its own private count, the same independence demonstrated with closures in Intermediate Chapter 2's makeIdGenerator challenge. - Interleaving the .next() calls between the two generators proves they don't share state — userIds reaching "user-2" has no effect on orderIds, which is still only at "order-1" at that point. - Each generator's count variable persists between .next() calls purely because of how yield pauses and resumes the function, exactly as explained earlier in this chapter.