Skip to content

Commit 17c3829

Browse files
committed
Implement BMI calculation function and add example usage
1 parent 231d91e commit 17c3829

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,11 @@
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;
20+
}
21+
22+
console.log(calculateBMI(90, 1.85)); // should return 26.3
23+
1824
// return the BMI of someone based off their weight and height
1925
}

0 commit comments

Comments
 (0)