Skip to content

Commit 27a5872

Browse files
committed
Fix BMI function to return number with 1 decimal place
1 parent f9b067e commit 27a5872

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

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

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,7 @@
1414
// Then when we call this function with the weight and height
1515
// It should return their Body Mass Index to 1 decimal place
1616

17-
// function calculateBMI(weight, height) {
18-
// // return the BMI of someone based off their weight and height
19-
// }
20-
21-
2217
function calculateBMI(weight, height) {
23-
const bmi = weight / (height * height);
24-
return bmi.toFixed(1);
18+
const bmi = weight / (height * height);
19+
return Number(bmi.toFixed(1));
2520
}
26-
27-
// Test cases
28-
console.log(calculateBMI(70, 1.73)); // Output: 23.4
29-
console.log(calculateBMI(80, 1.8)); // Output: 24.7
30-
31-
32-
33-

0 commit comments

Comments
 (0)