javascript - Is it possible to delete the object itself, not the reference -
var = { "example" : true }; var x = [a], y = [a]; delete x[0]; console.log(y);
in above code, possible have deleted, not reference in x ?
that's garbage collector. long there's reference object, not garbage collected.
if want cleaned up, make sure there no more references.
so answer question, no, there's no way explicitly destroy object. if a
, y[0]
still referencing it, can't x
variable.
to clear, x[0]
not referencing a
. pointing same object in memory a
referencing.
Comments
Post a Comment