Skip to content

Commit 976687d

Browse files
committed
1-bmi.js updated a code .... return Number(bmi.toFixed(1)); to so that the function return a number.
1 parent 4d2946e commit 976687d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,14 @@
1717
function calculateBMI(weight, height) {
1818

1919
const bmi = weight/(height*height);
20-
return bmi.toFixed(1);
20+
return Number(bmi.toFixed(1));
2121

2222
// return the BMI of someone based on their weight and height
2323
}
2424

25-
console.log("The BMI is",calculateBMI(70, 1.73));
25+
console.log("The BMI is",calculateBMI(70, 1.73));
26+
console.log(typeof calculateBMI(70,1.73));
27+
28+
// Thank you. As I see it n the console it looks like a number when actually it is a number,
29+
// the code has been updated to return a number as -----return Number(bmi.toFixed(1));
30+
// changing the string into number.

0 commit comments

Comments
 (0)