title: Adding two numbers concatenates them instead of calculating the sum
body: <p>I am adding two numbers, but I don't get a correct value.</p>
  
  <p>For example, doing <code>1 + 2</code> returns 12 and not 3</p>
  
  <p>What am I doing wrong in this code?</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>function myFunction() {
    var y = document.getElementById("txt1").value;
    var z = document.getElementById("txt2").value;
    var x = y + z;
    document.getElementById("demo").innerHTML = x;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p&gt;
    Click the button to calculate x.
    &lt;button onclick="myFunction()"&gt;Try it&lt;/button&gt;
  &lt;/p&gt;
  &lt;p&gt;
    Enter first number:
    &lt;input type="text" id="txt1" name="text1" value="1"&gt;
    Enter second number:
    &lt;input type="text" id="txt2" name="text2" value="2"&gt;
  &lt;/p&gt;
  &lt;p id="demo"&gt;&lt;/p&gt;</code></pre>
  </div>
  </div>
  </p>