Is it necessary (and if not necessary, is it useful?) To “release” a variable before making it a value of an object of another type. For example:
... var d = new Date(); ... d=null; // освобождение переменной ... d=new Date(2011,9,23); Is it necessary (and if not necessary, is it useful?) To “release” a variable before making it a value of an object of another type. For example:
... var d = new Date(); ... d=null; // освобождение переменной ... d=new Date(2011,9,23); There is no need to delete variables, since automatic garbage collection is implemented in JavaScript (unused memory is freed automatically), although it is possible. For example,
z = 0; delete z; or
z = New Number() delete z; Whether there is a practical benefit, it is not known, perhaps it can be determined by running specific tests for memory usage.
Source: https://ru.stackoverflow.com/questions/35672/
All Articles