Cape Town | 25-ITP-May | Asanda Dunn | Sprint 2 | Coursework/sprint2#1418
Cape Town | 25-ITP-May | Asanda Dunn | Sprint 2 | Coursework/sprint2#1418asandagwala wants to merge 12 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1 similar comment
This comment has been minimized.
This comment has been minimized.
| // =============> write your new code here | ||
|
|
||
| function multiply(a,b){ | ||
| return(a*b); |
There was a problem hiding this comment.
return a * b; would be enough.
The general syntax of the return statement is:
return expression;And the value of expression is returned.
There was a problem hiding this comment.
Thank you, I have implemented the reommended changes
|
|
||
| function calculateBMI(weight, height) { | ||
| let bmi = weight/(height *height) | ||
| return `${bmi.toFixed(1)}` |
There was a problem hiding this comment.
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.Note:
return `${bmi.toFixed(1)}`;is the same as
return bmi.toFixed(1);There was a problem hiding this comment.
I have corrected my mistake. Thank you so much
There was a problem hiding this comment.
Could you also answer these questions?
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?
| const result = `£${pounds}.${pence}`; | ||
| return result |
There was a problem hiding this comment.
Code is not properly formatted.
Have you installed the prettier VSCode extension and enabled "Format on save/paste" on VSCode,
as recommended in
https://github.com/CodeYourFuture/Module-Structuring-and-Testing-Data/blob/main/readme.md
?
There was a problem hiding this comment.
It's good that you have installed prettier and know how to format code.
The code you showed in the screenshot is not the the file I was referring to.
There was a problem hiding this comment.
This is how the code looks like on my VSCode.
If you haven't enabled format on save, you would need to manually use the "Format document" option to apply the formatter to format the code. And if you have more than one formatters installed, you may need to choose a default formatter for the "format on save" to work properly.
There was a problem hiding this comment.
Why not complete the implementation of the formatAs12HourClock() function? It's a good programming exercise.
There was a problem hiding this comment.
I did complete the formatAs12HourClock(), maybe I did not commit the work done on that file. Please check again if you are able to see it from your end
There was a problem hiding this comment.
I don't see the implementation of this functio on GitHub. I also don't see the changes you said you made in Sprint-2/2-mandatory-debug/0.js.
You could click the "Files changed" tab on your PR on GitHub to see what files are changed on GitHub. That's also typically how the code reviewer views the changes in a PR.



Self checklist
Module: Structure and testing data Sprint 2 work