Using while to iterate a javascript iterator
The key to iterating over a javascript Iterator is that next
returns a javascript object with two entries, value
and done
. If done is false, then calling next
on the iterator will yield another object with a value. When done
is true
then you're done!
while(object = objectIterator.next(); !object.done) {
myValue = object.value
}
Tweet