Skip to content

Commit 2ce418b

Browse files
committed
Added calculateBMI() implementation and test case using example values to verify output
1 parent b2530bc commit 2ce418b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
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-
}
19+
return (weight / (height * height)).toFixed(1); // toFixed(1) rounds to 1 decimal place.
20+
}
21+
22+
// Test case
23+
console.log(calculateBMI(70, 1.73)) // Output: 23.4

0 commit comments

Comments
 (0)