title: Get css equivalent of "max-width: 600px" using JavaScript
body: <p>This is a followup question to this quetsion: <a href="https://stackoverflow.com/questions/6850164/get-the-device-width-in-javascript">Get the device width in javascript</a>.</p>
  
  <p>What I'm trying to do, is get the equivalent css of <code>@media (max-width: 600px)</code> in JavaScript.</p>
  
  <p>The <a href="https://stackoverflow.com/a/6850319/5244870">accepted answer</a> says to do the following:</p>
  
  <pre><code>var width = (window.innerWidth &gt; 0) ? window.innerWidth : screen.width;
  </code></pre>
  
  <p>Is that still correct? Will it work for all devices?</p>
  
  <p>If it's correct, what's the point of checking <code>(window.innerWidth &gt; 0)</code>?</p>
  
  <p>I want to know if it still works. If you look at the last comment on the answer (with 6 upvotes) it says:</p>
  
  <blockquote>
    <p>How does this have so many upvotes? <code>var width = (window.innerWidth &gt;
    0) ? window.innerWidth : screen.width;</code> returns 667 on iphone 6 AND 6
    Plus. This solution does not work correctly.</p>
  </blockquote>