There was an error while loading. Please reload this page.
1 parent 1d3a340 commit b8dc470Copy full SHA for b8dc470
1 file changed
Sprint-3/3-mandatory-implement/1-bmi.js
@@ -16,11 +16,11 @@
16
17
function calculateBMI(weight, height) {
18
// return the BMI of someone based off their weight and height
19
- return weight / Math.pow(height, 2);
+ return (weight / Math.pow(height, 2)).toFixed(1);
20
}
21
22
console.log(
23
- `BMI base off weight in kg and height in metres is ${calculateBMI(70, 1.73).toFixed(1)}`,
+ `BMI base off weight in kg and height in metres is ${calculateBMI(70, 1.73)}`,
24
);
25
26
//draft pseudocode below
@@ -29,4 +29,4 @@ console.log(
29
//parameters : weight, height
30
//formula weight / height x height
31
//or weight / sqr height (by Method: Math.pow(parameter,power))
32
-//display BMI in one decimal place
+//by Method .toFixed(1) to return BMI in string in one decimal place
0 commit comments