DEV Community

Discussion on: Daily Challenge #57 - BMI Calculator

Collapse
stoutlabs profile image
Daniel Stout • Edited on

I couldn't resist posting a quick JavaScript solution... 😀

const calcBMI = (height, weight) => {
  const bmi = Number(weight / (height * height)).toFixed(1);
  return bmi <= 18.5 ? "underweight" : 
         bmi <= 25 ? "normal" :
         bmi <= 30 ? "overweight" : "obese"; 
}