title: How to make a simple click game in JavaScript?
body: <p>I am trying to write my first JavaScript game, it will be a block you click and every time you click it you get one point until you run out of time. Here is what I have so far... but the points don't go up when the onclick occurs.. </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>var click=0; 
  
  function hi(){
      click+=1; 
  }
  document.write(click); </code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
      &lt;head&gt;
       &lt;title&gt;Page Title&lt;/title&gt;
   &lt;/head&gt;
   &lt;body&gt; 
          &lt;button onclick="hi()" id="demo"&gt; &lt;/button&gt;
   &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>