When you add event listeners to DOM elements you also open up the possibility of creating a memory leak and adversely affecting memory usage and performance on your users' computer.
appendChild( ) and removeChild( ) are only from moving elements on and off the visible screen. They don't control when the JavaScript Garbage collector will delete them. If there is still something attached to the element, like an event listener, then the garbage collector will not remove the element from memory.
BAD TIMES.
So, when removing elements from the screen we should also remove any attached event listeners. This video explains how to do that.
On this page of the site you can watch the video online Removing Event Listeners with a duration of hours minute second in good quality, which was uploaded by the user Steve Griffith - Prof3ssorSt3v3 10 April 2018, share the link with friends and acquaintances, this video has already been watched 15,817 times on youtube and it was liked by 197 viewers. Enjoy your viewing!