A for...of loop consumes values from an iterator one at a time, hiding repeated next() calls and checks of each result’s done flag. section 6.2.1
Listing 6.1. Using a generator function to generate a sequence of values
function* WeaponGenerator(){ #A
yield "Katana"; #B
yield "Wakizashi"; #B
yield "Kusarigama"; #B
}
for(let weapon of WeaponGenerator()) { #C
assert(weapon !== undefined, weapon); #C
} #C
A generator yields a sequence of weapons that the loop consumes one value at a time. section 6.2

