I want a function which return the BMI. If my weight is 65 and my height is 1.8 so what will be my round BMI.
function bmiCalculator(weight, height) {
var bmi = 65/(1.8*1.8);
bmi = Math.round(bmi);
}
bmiCalculator();
I have tried so many time but I get 15 BMI and the expected is 20.
Can some body explain what is going behind the scene?
2
Answers
BMI is calculated by weight in kg dividing by height in meters multiplied by height in meters
You’re on the right track, just make sure to use the function parameters and call it.
Also, name your params appropriately.