Skip to content

Commit 2f41d57

Browse files
Update 1-bmi.js
updated comments for clarity on roundedBmi returning as a string.
1 parent 8c166ff commit 2f41d57

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ function calculateBMI(weight, height) {
1818
// return the BMI of someone based off their weight and height
1919
const heightSquared = height * height; // square the height
2020
const bmi = weight / heightSquared; // calculate BMI by dividing weight by height squared
21-
const roundedBmi = bmi.toFixed(1); // round the result to 1 decimal place
22-
return roundedBmi; // return the rounded BMI value
21+
const roundedBmi = bmi.toFixed(1); // round the result to 1 decimal place and return as a string.
22+
return roundedBmi; // return the string result of rounded BMI value
2323
}
2424
console.log(calculateBMI(70, 1.73)); // Example usage: should return 23.4
25-
console.log(calculateBMI(80, 1.8)); // Example usage: should return 24.7
25+
console.log(calculateBMI(80, 1.8)); // Example usage: should return 24.7

0 commit comments

Comments
 (0)