2 ms·
while(!iterator.next().done) I think you meant the above example and not the one you listed in the comment as generator objects in JS always return objects upo
by notNow 11y ago
while(!iterator.next().done)
I think you meant the above example and not the one you listed in the comment as generator objects in JS always return objects upon calling next method even after finish yielding for long and thus you could have an infinite loop on your hand here.