title: I'm using JavaScript to get the sum of 2 numbers that have been input by a user but the output values are wrong
body: <pre><code>&lt;script&gt;
          function getSum(a, b) {
              sum = a + b;
              document.write(sum);
          }
          var x = prompt();
          var y = prompt();
          getSum(x, y);
  &lt;/script&gt;
  </code></pre>
  <p>For example, I input 2 and 2. The output for that will be 22. It's as if it treats the values as if they were characters? But when I skip the whole prompt thing and replace x and y inside the getSum() with actual numbers, the code works. How do I fix this so that it will compute the number values inside variables?</p>