let v = {a:1}
let s = new Set();
s.add(v);
v = null;
at this time , s still has one element : {a:1}
enter image description here
I guess v and {a:1} are stored in different places, but I need an authoritative theory to explain this .
it seems about heap and stack?
let v = {a:1}
let s = new Set();
s.add(v);
v.b = 2;
at this time , s has one element : {a:1,b:2}.
However, I've learned ,v and {a:1} are two
different things.
if set b = null,just change the pointer that b point to .