title: What's the difference between <input type="hidden"> and global JS variable
body: <p>In our codebase we have both of them and I don't understand when to use which...</p>
  
  <p>In case of <code>&lt;input type="hidden" id="someFlag" /&gt;</code> we write/read value in the following way <code>$("#someFlag").val('1');</code> and  <code>$("#someFlag").val() == '1'</code></p>
  
  <p>Why not just simply add global variable into the JavaScript file?</p>
  
  <pre><code>var someFlag2;
  ...
  someFlag2 = '1';
  someFlag2 == '1'
  </code></pre>
  
  <p>Are there some differences between these approaches?</p>