Skip to content

Commit 9ba67d2

Browse files
author
AlanGit-debug2604
committed
3-mandatory-implement 1-bmi.js Implemented BMI calculation function and log result to one decimal place
1 parent 742ac3f commit 9ba67d2

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,17 @@
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);
1920
}
21+
22+
console.log(
23+
`BMI base off weight in kg and height in metres is ${calculateBMI(70, 1.73).toFixed(1)}`,
24+
);
25+
26+
//draft pseudocode below
27+
//name of function calculateBMI
28+
//key word return
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

0 commit comments

Comments
 (0)