title: Javascript math error with leading zeroes
body: <p>I am an amateur programmer writing simple HTML/Javascript programs, and I recently ran into something I can't explain. I have a small program that sets the starting and ending time for an appointment. The format is HHMMSS for both. I hard-coded the start times I needed, for example 103000 or 123000, and then wrote a line of code to add 10000 to get the end time. This worked fine until I tried 073000 + 10000. The result, instead of being 083000 (or at least 83000), ended up being 40208. </p>
  
  <p>I would write the problem off as an issue with the leading 0, but 093000 + 10000 = 103000, which is what I would expect. What is going on with 073000 + 10000 = 40208?</p>
  
  <p>I fixed the program a different way, but I am stumped by this. Many thanks for any explanation you can provide. </p>
  
  <p>Here is some simple code from w3schools that produces 40208 as the addition result:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  
  &lt;button onclick="myFunction()"&gt;Try it&lt;/button&gt;
  
  &lt;p id="demo"&gt;&lt;/p&gt;
  
  &lt;script&gt;
  function myFunction() {
      var x = 073000 + 10000;
      document.getElementById("demo").innerHTML = x;
  }
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>