I have been reading over the MDN topic of Iterators as well as other sites on this topic and It seems no-mater what I try, my iterator only yields an empty string and does not give me any values beyond this point.
First, remove the
[Symbol.iterator], since you’re not using a generator for the iterator.
Then the code that updates the
sum should be inside the
next function. Otherwise it will not get updated and you might get an infinite loop.
next function doesn’t recognize
next is not
next as an arrow function instead.
@kevcomedia Thank you this answers some questions I had. I was wondering about the * and weather it was necessary. I made the changes you recommended and It now works inside of ndb however in codepen it causes the page to lockup every time. I updated the saved version of what is working inside of node debugger and pasted that into the codepen. Any ideas why the page now locks up (prob infinite loop?)
I don’t get any lockups though… Did you update it?
I just checked and indeed it seems to be working now without lockups, I might have made a minor change but perhaps I just needed to close the page and reopen it.
@kevcomedia Thank you very much for helping me solve this, and better understand iterators. I greatly appreciate this as I have been struggling for hours.