Skip to content

Commit 86e42bb

Browse files
committed
Use toFixed for BMI rounding
1 parent 7d37691 commit 86e42bb

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

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

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

1717
function calculateBMI(weight, height) {
18-
const bmi = weight / (height * height);
19-
return Math.round(bmi * 10) / 10;
18+
return Number((weight / (height * height)).toFixed(1));
2019
}
2120
console.log(calculateBMI(70, 1.73));

0 commit comments

Comments
 (0)