Skip to content

Commit 3eb628c

Browse files
authored
Refactor BMI calculation to use toFixed for precision
1 parent 86b27be commit 3eb628c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616

1717
function calculateBMI(weight, height) {
1818
// return the BMI of someone based off their weight and height
19-
return Math.round((weight/(height*height)*10))/10;
19+
return Number((weight / (height * height)).toFixed(1));
2020
}

0 commit comments

Comments
 (0)