title: store data from input form to var for javascript function
body: <p>Hi I am learning javascript right now.
  so I want to make a function that converts fahrenheit to celsius but with an input to store in variable and then shows the result with <code>alert(result);</code></p>
  
  <p>here's my code from my basic understanding</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var f = document.getElementById("fa").value;
  
  function toCelsius(f) {
    var result = (5/9) * (f-32);
    alert (result);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;p&gt;calls a function to convert from Fahrenheit to Celsius:&lt;/p&gt;
  &lt;form&gt;
    input fahrenheit :&lt;input type="number" id="fa"&gt;
    &lt;button onclick="toCelsius(f)"&gt;submit&lt;/button&gt;
  &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>everytime I input a number, the result does not change, I assume I'm wrong in .value or .innerHTML ?</p>