title: Why does my calculation function not run properly?
body: <p>I need to create a BAC calculator in JavaScript. When I run the code, the form validation works but the calculate function doesn't seem to run.</p>
  <pre><code>    function validateForm() {
      let weight = document.getElementById(&quot;weight&quot;).value;
      let beer = document.getElementById(&quot;beer&quot;).value;
      let wine = document.getElementById(&quot;wine&quot;).value;
      let liquor = document.getElementById(&quot;liquor&quot;).value;
      let hours = document.getElementById(&quot;hours&quot;).value;
      if (weight &lt;= 0){
          alert(&quot;Weight must be more than zero&quot;)
          return false;
      }
  
      else if (beer&lt;0 || wine&lt;0 || liquor&lt;0 || hours&lt;0){
          alert(&quot;Number must be zero or higher&quot;)
          return false;
      }
      else if(isNaN(weight)||isNaN(beer)||isNaN(wine)||isNaN(liquor)||isNaN(hours)){
          alert(&quot;Answer must be a number&quot;)
          return false;
      }
      else if (weight == null||beer == null||wine == null||liquor == null||hours == null){
          alert(&quot;All fields must be filled&quot;)
          return false;
      }
      else{
          return calculate;
      }
  }
  function calculate() {
      let weight = document.getElementById(&quot;weight&quot;).value;
      let beer = document.getElementById(&quot;beer&quot;).value;
      let wine = document.getElementById(&quot;wine&quot;).value;
      let liquor = document.getElementById(&quot;liquor&quot;).value;
      let hours = document.getElementById(&quot;hours&quot;).value;
      let answer = (((((beer * 0.54)+(wine*0.6)+(liquor*0.6))*7.5)/weight)-(hours*0.015)).toFixed(3)
      document.getElementById(&quot;bac&quot;).value = answer;
      document.getElementById(&quot;answer&quot;).append(answer);
      return answer;
  }
  </code></pre>
  <p>If anyone has any answers I'd be more than happy. Thank you.</p>