Understanding Weak Reference In JavaScript
Smashing Magazine
MAY 25, 2022
The code below illustrates how to use WeakSet() and some of the methods available: const human = new WeakSet(); let paul = {name: "Paul"}; let mary = {gender: "Mary"}; // Add the human with the name paul to the classroom. let smashing = {name: "magazine"}; let arr = [smashing]; // Overwrite the reference. It cannot be looped through.
Let's personalize your content