title: Incrementing a number with JavaScript returns an error
body: <pre><code>var count = {
      digit: 0,
      increment: function() {
          setInterval(function() {
              count.digit++;
          }, 500);
          if (count == 10) {
              count.increment = null;
          }
      }
  };
  document.write("The number is " + count.digit);
  count.increment();
  </code></pre>
  
  <p>The result is: "The number is 0" but it does not increment. Why?</p>