r/javascript • u/[deleted] • Aug 21 '18
Effectively supported in all browsers, JavaScript has its own form of media queries just like CSS.
https://developer.mozilla.org/en-US/docs/Web/API/Window/matchMedia
465
Upvotes
r/javascript • u/[deleted] • Aug 21 '18
11
u/rabidhamster Aug 22 '18
Except that this isn't necessarily about styling the page. You can run different conditional branching, loops, JSON queries to the server, etc. based on the results of the window width. Just because you personally would use it to make style changes doesn't make it inherently CSS. By that logic, Javascript is just FORTRAN, because they both have "if" statements.