title: Saving a variable globaly
body: <p>I am a new developer and I am trying to make a button that each user can only press once and that has a counter that saves across all users. My code so far is:</p>
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;meta charset=&quot;utf-8&quot;&gt;
      &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width&quot;&gt;
      &lt;title&gt;replit&lt;/title&gt;
      &lt;link href=&quot;style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
    &lt;/head&gt;
    &lt;body&gt;
   &lt;script&gt;
  let btn = document.createElement(&quot;button&quot;);
  btn.innerHTML = &quot;Join Kaiism&quot;;
  btn.onclick = function counter() {
    document.write (x + 1);
  
  };
  document.body.appendChild(btn);
  var x ;//global variable  
  x = 0
  document.write(x)
  
     &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  <p>Is there a way to save the variable x and keep it the same globally so that all users can see the total time it has been pushed?</p>