We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fa6a305 commit 77770ddCopy full SHA for 77770dd
1 file changed
Sprint-2/3-mandatory-implement/1-bmi.js
@@ -15,10 +15,8 @@
15
// It should return their Body Mass Index to 1 decimal place
16
17
function calculateBMI(weight, height) {
18
- let numWeight = Number(weight.slice(0, -2));
19
- let numHeight = Number(height.slice(0, -1));
20
- let BMI = numWeight / (numHeight * numHeight);
21
- return Math.round(BMI * 10) / 10;
+ let BMI = weight / (height * height);
+ return (BMI * 10) / 10;
22
}
23
24
-console.log(`Your BMI is: ${calculateBMI("70kg", "1.83m")}`);
+console.log(`Your BMI is: ${calculateBMI(70, 1.83)}`);
0 commit comments