develwoutacause’s avatardevelwoutacause’s Twitter Archive—№ 1,837

    1. Today's #WTF #JavaScript snippet. The following code loops infinitely. Apparently the Set iterator dynamically updates with new data added to the Set. This applies *even* when you explicitly call .values() before iterating.
  1. …in reply to @develwoutacause
    You have to do Array.from(set.values()) to fully snapshot the state first, before you can safely iterate over it with mutations.