Skip to content

Commit 2d4a769

Browse files
Committing the actions for 1-bmi.js
1 parent 901a010 commit 2d4a769

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
// Then when we call this function with the weight and height
1515
// It should return their Body Mass Index to 1 decimal place
1616

17+
// solution 1
1718
function calculateBMI(weight, height) {
18-
// return the BMI of someone based off their weight and height
19-
}
19+
const bmi = weight / (height ** 2);
20+
return Number(bmi.toFixed(1));
21+
}
22+
console.log(`My BMI is: ${calculateBMI(55, 1.3)}`)
23+
24+
// solution 2
25+
// To make this program fit for real world use, I would implement a conversion for various metrics used for height and weight.

0 commit comments

Comments
 (0)