Skip to content

Commit 9d819ad

Browse files
Fix BMI return type and remove global variable
1 parent 129de51 commit 9d819ad

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
// ===========> Write your prediction here
55
// Prediction: The output will incorrectly say the last digit is "3" for all numbers, because the function uses the global variable 'num' (103) instead of accepting a parameter.
66

7-
// We don't need this global variable, so I commented it out:
8-
// const num = 103;
9-
107
// We added 'num' as a parameter inside the parentheses
118
function getLastDigit(num) {
129
return num.toString().slice(-1);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ function calculateBMI(weight, height) {
1212
// 2. Divide weight by height squared (الوزن تقسيم الطول المربع)
1313
const bmi = weight / heightSquared;
1414

15-
// 3. Return the result to 1 decimal place (إرجاع النتيجة بخانة عشرية واحدة)
16-
return bmi.toFixed(1);
15+
// 3. Return the result to 1 decimal place as a NUMBER (إرجاع النتيجة بخانة عشرية واحدة كرقم)
16+
return Number(bmi.toFixed(1));
1717
}
1818

1919
// === Let's test the function to see if it works! ===

0 commit comments

Comments
 (0)