Skip to content

Commit 2c6fe69

Browse files
committed
Fix getLastDigit function to accept parameter and implement BMI calculation
1 parent 7b05d22 commit 2c6fe69

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

Sprint-2/2-mandatory-debug/2.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ console.log(`The last digit of 105 is ${getLastDigit(105)}`);
3737
console.log(`The last digit of 806 is ${getLastDigit(806)}`);
3838

3939

40-
41-
4240
// This program should tell the user the last digit of each number.
41+
4342
// Explain why getLastDigit is not working properly - correct the problem
43+
//(A) The function `getLastDigit` needed to accept a parameter `num` in order to work properly.

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,9 @@
1515
// It should return their Body Mass Index to 1 decimal place
1616

1717
function calculateBMI(weight, height) {
18-
// return the BMI of someone based off their weight and height
19-
}
18+
const heightSquared = height * height;
19+
const bmi = weight / heightSquared;
20+
return Number(bmi.toFixed(1));
21+
}
22+
23+
//console.log(calculateBMI(80, 1.85)); // expected output: 23.4

0 commit comments

Comments
 (0)