Are null and undefined equally valid for explicit object creation inaccessible?

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;
+4
source share
1 answer

It does not matter what value you assign: it may be null, undefined, {}or 42.

, .

- , , , .

Google Chrome, :

enter image description here

JSFiddle: http://jsfiddle.net/r9b5taxf/

+3

All Articles