A question:
If a DOM element is created within the function to which the parent is not assigned, then is it itself destroyed when the function has been executed or does it remain to weigh in memory?
if it remains in memory, then how to destroy it?

function demoCreate(){ var domNode = document.createElement("div"); ...//здесь идет работа с ним //уничтожется ли domNode после окончания выполнения этой функции??? } 

    1 answer 1

    In this case, when the created element is within the same function and has not been added to the DOM, and there are no references to it from other objects, then at the end of the execution of the function it will be erased from memory. The mechanism of erasing from memory varies depending on the browser used, but in theory it is in each of them (Garbage Collection). The same applies when an element is removed from the DOM, and all its links and references to it are deleted.

    The delete function is useless in this case.