Difference between document.addEventListener and window.addEventListener?
The document and window are different objects and they have some different events. Using addEventListener() on them listens to events destined for a different object. You should use the one that actually has the event you are interested in. For example, there is a “resize” event on the window object that is not on the … Read more