Birmingham | ITP-Jan-26 | Ayodeji Ayorinde | Sprint 2 | Structuring and Testing Data#1193
Birmingham | ITP-Jan-26 | Ayodeji Ayorinde | Sprint 2 | Structuring and Testing Data#1193Ayogit1 wants to merge 3 commits intoCodeYourFuture:mainfrom
Conversation
| // The last digit of 806 is 3 | ||
| // Explain why the output is the way it is | ||
| // =============> write your explanation here | ||
| // =============> write your explanation here. num is a constant variable, it's value cannot change. |
There was a problem hiding this comment.
You fixed the bug, but it is not because of the reason you described on line 23. (You could replace the const on line 7 by let and the code would still produce the same result).
Can you use AI to help you figure out the actual reason, and revise your explanation?
|
|
||
| function calculateBMI(weight, height) { | ||
| // return the BMI of someone based off their weight and height | ||
| return Math.round((weight) / (height ** 2)).toFixed(1) |
There was a problem hiding this comment.
-
Have you tested your function to see if it returns the correct value? For example, what value do you expect
calculateBMI(22.34, 1)to return? Does your function return the value you expect? -
In addition, what type of value do you expect your function to return? A number or a string?
Does your function return the type of value you expect?
Different types of values may appear identical in the console output, but they are represented and treated differently in the program. For example,
console.log(123); // Output 123
console.log("123"); // Output 123
// Treated differently in the program
let sum1 = 123 + 100; // Evaluate to 223 -- a number
let sum 2 = "123" + 100; // Evaluate to "123100" -- a string.| // You will need to come up with an appropriate name for the function | ||
| // Use the MDN string documentation to help you find a solution | ||
| // This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase | ||
| function upCase(strCar) { |
There was a problem hiding this comment.
The current function name does not quite tell people it returns the converted string in upper snake case format.
Can you suggest a more descriptive function name?
Learners, PR Template
Self checklist
Changelist
This the complete of Sprint 2 tasks