title: Passing HTML input value as a JavaScript Function Parameter
body: <p>I am new to JavaScript, and I'm trying to figure out how to pass user-inputted values as a parameter to a JavaScript function. Here is my code:</p>
  
  <pre><code>&lt;body&gt;
  &lt;h1&gt;Adding 'a' and 'b'&lt;/h1&gt;
  &lt;form&gt;
    a: &lt;input type="number" name="a" id="a"&gt;&lt;br&gt;
    b: &lt;input type="number" name="b" id="a"&gt;&lt;br&gt;
    &lt;button onclick="add(a,b)"&gt;Add&lt;/button&gt;
  &lt;/form&gt;
  &lt;script&gt;
    function add(a,b) {
      var sum = a + b;
      alert(sum);
    }
  &lt;/script&gt;
  &lt;/body&gt;
  </code></pre>