Checking if a value exists
suggest changeTo check if a value exits in a WeakSet, use the .has()
method.
const obj1 = {},
obj2 = {};
const weakset = new WeakSet([obj1]);
console.log(weakset.has(obj1)); // true
console.log(weakset.has(obj2)); // false
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents