When data is no longer useful, it is best to release its reference by placing its value null-this is called dereferencing (dereference). This applies to global political reforms and properties of global objects.
function Createperson (name) { var Localperson = new Object (); Localperson.name = name; return Localperson; } var Globalperson = Createperson ("Nicolas");//manual Unbind Globalperson = null;
Localperson has left its execution environment after the execution is complete. But for global variables, we need to manually dereference them when we're not using them. Releasing a reference to a value does not mean that the memory occupied by the value is automatically reclaimed, and the true purpose of dereferencing is to leave the value out of the execution environment so that it can be reclaimed the next time the garbage collector runs.
JS Management Memory