title: How to get the counter to start from 0 again in JavaScript
body: <p>Ok. I am trying a function that counts numbers onclick. There are 2 buttons; the one that counts and the one that saves the number. When the latter is clicked the former should start counting from 0 but my code starts from the current number</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>let count = 1;
  
  function increment() {
    console.log("The button was clicked");
    document.getElementById("count-el").innerText = count;
    count += 1;
  }
  function save() {
    document.getElementById("save-btn").innerText = count - 1;
    document.getElementById("count-el").innerText = 0;
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>body {
    margin: -2px 0 0 0;
    zoom: .8;
  }
  h1, h2 {
    margin: 0;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;h1&gt;People entered&lt;/h1&gt;
  &lt;h2 id="count-el"&gt;0&lt;/h2&gt;
  
  &lt;button id="increment-btn" onclick="increment()"&gt;INCREMENT&lt;/button&gt;
  
  &lt;button id="save-btn" onclick="save()"&gt;SAVE&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>