title: Javascript - Input Value NaN
body: <p>Im new to Javascript and i was doing some DOM maniputalion, and i tried to create the BMI (body mass index) calculator, which is bodyMass / ( bodyWeight * bodyWeight ).</p>
  <p>Then i've done some code:</p>
  <p>HTML:</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>var bodyMass, bodyWeight;
  bodyMass = parseInt(document.getElementById("bodyMass").value, 10);
  bodyWeight = parseInt(document.getElementById("bodyWeight").value, 10);
  var BMI = bodyMass / (bodyWeight * bodyWeight);
  document.getElementById("check").onclick = function() {
    alert(BMI);
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="text" placeholder="Body Mass" id="bodyMass"&gt;
  &lt;input type="text" placeholder="Body Weight" id="bodyWeight"&gt;
  &lt;button id="check"&gt;CHECK&lt;/button&gt;
  &lt;div id="result"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>