re: Sets in Javascript ES6 VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Thanks for the post. The last example is a little confusing to me: When setting obj = null, and afterwards testing with set.has(obj), I would expec...
 

In that last example, we added a reference to the object, inside the variable obj. By setting obj to null, we eliminate the last reference to the object we stored in our set. Therefore, because this is a WeakSet, the object is garbage-collected in order to free memory.

Hope it's clear :)

code of conduct - report abuse