According to this answer on a related question, it is best to make the object explicitly inaccessible if you want them to be garbage collected. For all practical purposes and goals, does it matter if it was done with meaning nullor meaning undefined?
Soon, both of these objects (regardless of what they originally referred to) will be equally accessible to the garbage collector?
window.foo = null;
window.bar = void 0;
source
share