Skip to content

Commit ed8e968

Browse files
committed
Implement calculateBMI function to return BMI as a string formatted to 1 decimal place
1 parent 3ca2ab1 commit ed8e968

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@
1616

1717
function calculateBMI(weight, height) {
1818
// return the BMI of someone based off their weight and height
19+
const bmi = weight / (height * height);
20+
return bmi.toFixed(1);
1921
}
22+
23+
console.log(calculateBMI(70, 1.73)); // Output: "23.4"

0 commit comments

Comments
 (0)