What is the best way to loop through a set in TypeScript? Using for..of does not seem to work properly:
'Set<string>' is neither an array nor a string type
Using .forEach
is not ideal since it obscures the context of this
. I would rather avoid using a while loop with a try catch block. Is there something I am overlooking? Surely, it shouldn't be so complicated that it requires a try {while} catch {} approach.