title: How to make buttons that increment and decrement a value when clicked?
body: <p>I am new to programming. Every time I run this code, nothing happens. Can you please tell me why this is?</p>
  
  <pre><code>&lt;body&gt;
    &lt;input type=button value="increment" onclick="button1()" /&gt;
    &lt;input type=button value="decrement" onclick="button2()" /&gt;
    &lt;script type="text/javascript"&gt;
      var x = 0
      document.write(x)
  
      function button1() {
        document.write(x++)
      }
      function button2(){
        document.write(x--)   
      }
    &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>