title: Can two separate JavaScript scripts share variables?
body: <p>If I have two separate scripts in an HTML page with JavaScript are the variables shared between the entire page? Or only within their own declarations?</p>
  
  <p>Example:</p>
  
  <pre><code>&lt;script&gt; var title = "Hello World!"; &lt;/script&gt;
  // random HTML/PHP
  &lt;script&gt; document.write(title); &lt;/script&gt;
  </code></pre>
  
  <p>Will that write "Hello World!"?
  This seems like bad coding convention how else could I achieve something like this with proper form.</p>