My issue
console.log(bmi.toFixed(2)+ " "+ bmicaterogy);
why we usebmi.toFixed(2) here
My code
const height = [1.70, 1.65, 1.80, 1.60, 1.75];
const weight = [30, 55, 90, 102, 65];
/* Using these 5 users find the BMI */
/* Update your code below this line */
for(let i =0;i<height.length;i++){
const bmi=weight[i]/(height[i]*height[i]);
let bmicaterogy;
if(bmi<18.5){
bmicaterogy="underweight";
}else if (bmi>=18.5&&bmi<=24.9){
bmicaterogy="normal weight";
}else if (bmi>=25&&bmi<=29.9){
bmicaterogy="Overweight";
}else{
bmicaterogy="obese";
}
console.log(bmi.toFixed(2)+ " "+ bmicaterogy);
}
Learning course: Web development using JavaScript
Problem Link: BMI Calculator Practice Problem in Web development using JavaScript - CodeChef