I saw that you can change styles with the CSS @media Rule, and you can also add window.addEventListener('resize', handleResize); in your javascript to change your document depending one its size.
Is there any difference and should you use one over the other? Or are they interchangeable?