title: How to get browser width using JavaScript code?
body: <p>I am trying to write a JavaScript function to get the current browser width.</p>
  <p>I found this one:</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>console.log(document.body.offsetWidth);</code></pre>
  </div>
  </div>
  </p>
  <p>But its problem that it fail if the body has width 100%.</p>
  <p>Is there any other better function or a workaround?</p>