const key = {}; const cache = new WeakMap([[key, undefined]]); console.log(cache.has(key), cache.get(key)); console.log(cache.has({}), cache.get({}));