Skip to content

Commit b8dc470

Browse files
author
AlanGit-debug2604
committed
use by Method .toFixed(1) to return BMI in string in one decimal place
1 parent 1d3a340 commit b8dc470

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616

1717
function calculateBMI(weight, height) {
1818
// return the BMI of someone based off their weight and height
19-
return weight / Math.pow(height, 2);
19+
return (weight / Math.pow(height, 2)).toFixed(1);
2020
}
2121

2222
console.log(
23-
`BMI base off weight in kg and height in metres is ${calculateBMI(70, 1.73).toFixed(1)}`,
23+
`BMI base off weight in kg and height in metres is ${calculateBMI(70, 1.73)}`,
2424
);
2525

2626
//draft pseudocode below
@@ -29,4 +29,4 @@ console.log(
2929
//parameters : weight, height
3030
//formula weight / height x height
3131
//or weight / sqr height (by Method: Math.pow(parameter,power))
32-
//display BMI in one decimal place
32+
//by Method .toFixed(1) to return BMI in string in one decimal place

0 commit comments

Comments
 (0)