add event listener on width screen resize code example Example: add event listener on width screen resize window.addEventListener('resize', reportWindowSize);