I can't find any example on MDN. I came up with this,
const simpleMap = new WeakMap()
const simpleObject = {};
simpleMap.set(simpleObject, "A Value");
if(simpleMap.has(simpleObject)) {
simpleMap.set(simpleObject, "A New Value");
}
question from:https://stackoverflow.com/questions/66052782/how-to-update-a-value-of-a-existing-key-in-weakmap