-
Today's #WTF #JavaScript snippet. The following code loops infinitely. Apparently the
Setiterator dynamically updates with new data added to theSet. This applies *even* when you explicitly call.values()before iterating. -
You have to do
Array.from(set.values())to fully snapshot the state first, before you can safely iterate over it with mutations.
develwoutacause’s Twitter Archive—№ 1,836