windowaddEventListenerhashchange
window.addEventListener is a method of the Window interface used in web browsers to register event listeners for events that occur on the window or document. It allows multiple listeners for the same event type and enables control over how events propagate through the capture and bubble phases.
The basic syntax is window.addEventListener(type, listener, options). Type is a string such as 'load', 'resize', 'scroll',
The once option, if set to true, automatically removes the listener after its first invocation. The passive
Removal of a listener is done with window.removeEventListener(type, listener, options). It is important to pass the
Common use cases include responding to window resize, load, or beforeunload events, and coordinating cleanup when