var weight = parseInt(prompt("What is your weight?"));
var height = parseInt(prompt("What is your height?"));
var bmi;
bmi= weight/ height;
var bmiResult = bmi.toFixed(2);
alert("your weight is" + bmiResult);

if (bmiResult>=30) {
  alert("obese");
}
else if (bmiResult>25 || bmi<30) {
  alert('overweight');
}
else if (bmiResult>18.5 || bmi<=25) {
  alert('normal');
}
else if (bmiResult>=16 || <=18.5) {
  alert('underweight');
}
else (bmiResult<16) {
  alert('very underweight');
}


这段代码似乎无法正常工作,我也无法弄清楚原因...我试图根据用户输入的体重/身高来使if / else语句起作用。谁能解释为什么它不起作用?

最佳答案

else if (bmiResult>=16 || <=18.5){ alert('underweight');}

||中的错误

10-06 04:34