Skip to content

Commit 84ed53e

Browse files
committed
i returned the Body Mass Index(BMI) of myselfin return function and then explained it in comment how to calculate the BMI.
1 parent a696e17 commit 84ed53e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Sprint-2/3-mandatory-implement/1-bmi.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,14 @@
1515
// It should return their Body Mass Index to 1 decimal place
1616

1717
function calculateBMI(weight, height) {
18-
// return the BMI of someone based off their weight and height
19-
}
18+
var bmi = weight / (height * height);
19+
var bmis = bmi.toFixed(1);
20+
return `Your bmi is ${bmis}`;
21+
22+
// return the BMI of someone based off their weight and height
23+
}
24+
console.log(calculateBMI(85, 1.75));
25+
// based on the above code: My weight is 85 kg and my height is 1.75m.
26+
// first i squared my height: 1.75 * 1.75 = 3.0625.
27+
// then i divided my weight by the squared height: 85 / 3.0625= 27.8
28+
// so my BMI is `27.8`.

0 commit comments

Comments
 (0)