-1

Having technical issues with this line of code. I want it to first calculate the BMI than determine if weight is over 25 tell patient that they are overweight. If under 18.5 they are underweight. Cant Seem To get the function right.

var calculate 
var test;
calculate = document.getElementById("answer");
calculate.innerHTML =  (weight/(height*height))* 703;

if(calculate > 25)
{
calculate = document.getElementById("answer06");
calculate.innerHTML = "you are fat";
}
else if(calculate < 18.5)
{
calculate = document.getElementById("answer06");
calculate.innerHTML = "you are to skinny";
}
Marty
  • 39,033
  • 19
  • 93
  • 162

1 Answers1

4
var bmi = (weight/(height*height))* 703;
calculate.innerHTML = bmi;

if(bmi > 25)

Update:

var bmi = (weight/(height*height))* 703;
document.getElementById("answer").innerHTML = bmi;

if (bmi > 25)
{
    document.getElementById("answer06").innerHTML = "you are fat";
}
else if (bmi < 18.5)
{
    document.getElementById("answer06").innerHTML = "you are too skinny";
}
artm
  • 8,554
  • 3
  • 26
  • 43