Is the element <canvas>in itself taking memory? Or will it be garbage collection, like any other object without links?
Yes, it still exists. Yes, it will be garbage collection in due time.
Other posters seem a bit confused by the difference in GC behavior between variable canvas and element <canvas> . , . , . . .
, , . GC'd, . <canvas> , , , null - , (), .
, , , , . , , ( ) , " ", , - . - DOM JS - - GC'd , . :
function a() {
const div = document.createElement('div');
return function() {
console.log(div);
};
}
function b() {
const func = a();
}
b func. a, DOM . div , . DOM . b , func , , . , div . , GC'd ( ).
. , .