title: Javascript variable declaration in head vs body
body: <p>Is there a difference between declaring a variable in the head and using it in the body like so....        </p>
  
  <pre><code>       &lt;head&gt;
            &lt;script&gt;
               var girlFriendName = "Jennifer Lawrence";
             &lt;/script&gt;
         &lt;/head&gt;
          &lt;body&gt;
              &lt;script&gt;
               console.log("I wish my girlfriend was " + girlFriendName);
             &lt;/script&gt;
          &lt;/body&gt;
  </code></pre>
  
  <p>And declaring it and using it in the body like so..</p>
  
  <pre><code>          &lt;body&gt;
             &lt;script&gt;
               var girlFriendName = "Jennifer Lawrence";
             &lt;/script&gt;
              &lt;script&gt;
               console.log("I wish my girlfriend was " + girlFriendName);
             &lt;/script&gt;
           &lt;/body&gt;
  </code></pre>
  
  <p>Is there ever a case when you might want to declare them in the head as opposed to the body?</p>