Why the EventListener is so hard to remove?

Assigned a variable node from the DOM. Then added to this variable method to listen for events.. Then decided to remove the variable, I thought that all methods of this variable is also deleted.. But the listener is still running.

var btn = document.querySelector('.btn');
btn.addEventListener('click', function() {
console.log('click');
}
// the listener is still working.. I'm confused
btn = null;


Why to remove a listener must use a special method .removeEventListener? Variable is equal to null, why is this not enough?
June 10th 19 at 15:45
1 answer
June 10th 19 at 15:47
Solution
Because the variable btn is only one reference to the element with the class .btn. To remove a listener, you need to remove the element itself, not a variable referencing it (because it "listens" for events are not variable and the element)

Find more questions by tags JavaScript