Joe Honton
Oct 6, 2022

--

TIL how to use yield and a generator to iterate a class object. Cool. Thanks.

// Generator

*[Symbol.iterator]() {

for (const element of this.elements) {

yield element;

}

}

--

--

Joe Honton
Joe Honton

Written by Joe Honton

Princeps geographus, Read Write Tools

Responses (1)