Today I Learned

hashrocket A Hashrocket project

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
}
See More #javascript TILs
Looking for help? At Hashrocket, our JavaScript experts launch scalable, performant apps on the Web, Android and iOS. Contact us and find out how we can help you.