Skip to content

Commit 8473252

Browse files
committed
3-mandatory-implement questions answered
1 parent 457005f commit 8473252

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,22 @@
1717
function calculateBMI(weight, height) {
1818
let bmiNum = weight / (height * height);
1919
bmiNum = bmiNum.toFixed(1);
20-
return bmiNum;
20+
return typeof bmiNum;
2121
}
2222

2323
console.log(calculateBMI(70, 1.73));
24+
25+
// What type of value do you expect your function to return? A number or a string?
26+
//I expect function to return string as required, toFixed() change the type of number to a string.
27+
28+
// Does your function return the type of value you expect?
29+
//Yes I did expect a string returned.
30+
31+
// Different types of values may appear identical in the console output, but they are represented and treated differently in the program. For example,
32+
33+
// console.log(123); // Output 123(number)
34+
// console.log("123"); // Output 123(string)
35+
36+
// // Treated differently in the program
37+
// let sum1 = 123 + 100; // Evaluate to 223 -- a number
38+
// let sum 2 = "123" + 100; // Evaluate to "123100" -- a string.

0 commit comments

Comments
 (0)