title: Adding Javascript variables
body: <p>So, I'm relatively new to JavaScript and I was wondering how I would add the values from two inputs and echo out the result. Here's what I have so far:</p>
  
  <pre><code>function math (form) {
      var input1 = form.input1.value;
      var input2 = form.input2.value;
      var input3 = input1 + input2;
      document.write (input3);
  }
  </code></pre>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;form action="" method="GET"&gt;
     &lt;input type="text" name="input1"&gt;
     &lt;input type="text" name="input2"&gt;
     &lt;input type="button" name="button" onClick="math(this.form)"&gt;
  &lt;/form&gt; 
  </code></pre>
  
  <p>I expected that when I entered a number into each input it would spit out the sum of the two numbers. Instead it just prints both numbers individually. </p>
  
  <p>How can I get it to print the sum of the two numbers? </p>