Conversation
✅ Deploy Preview for cyf-onboarding-module ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
abdishakoor-dev
left a comment
There was a problem hiding this comment.
This is in good shape. The debug section is the strongest part: all three files run and give the right output, and your explanation in 2.js about the function ignoring its argument is exactly right. Good to see you attempt the stretch too.
Four things to look at:
-
1-key-errors/1.jsline 29, see my comment. -
1-key-errors/2.jsline 34, see my comment. -
3-mandatory-implement/3-to-pounds.js, see my comment. -
4-mandatory-interpret/time-format.jsanswers d) and e), see my comment. -
Could you run Prettier on the files you have changed? Most of them are not formatted at the moment.
Add the Needs Review label again when you have pushed.
| // =============> write your new code here | ||
|
|
||
| function convertToPercentage(decimalNumber) { | ||
| return percentage = `${decimalNumber * 100}%`; |
There was a problem hiding this comment.
The original had two lines here, const percentage = ... and then return percentage. You have combined them into one, but the const has gone, so percentage is no longer being declared. Does this function need that variable at all, or could you return the template literal straight away?
There was a problem hiding this comment.
The function works when I test it. However, I should have kept the const percentage declaration as it is. Or return the template literal straight away.
| return num * num; | ||
| } | ||
|
|
||
| console(square(3)); |
There was a problem hiding this comment.
Run this line on its own. console is an object, not a function, so this throws. What did you mean to call?
Separately, your prediction on line 9 says ReferenceError, and your answer on line 19 correctly says SyntaxError. Worth thinking about why a ReferenceError could never happen in this particular file: what has to succeed before any line of a file can run at all?
There was a problem hiding this comment.
I was testing the function and forgot to delete the whole console(square(3)) line.
Yes my prediction was wrong. ReferenceError happens when a variable is not declared properly. Or a local variable is used in a global scope.
|
|
||
| // You should call this function a number of times to check it works for different inputs | ||
|
|
||
| function toPound(priceInPence) { |
There was a problem hiding this comment.
Two things here. The task asks for a function called toPounds and this one is toPound. And it says to call it a number of times to check it works for different inputs, where there is only the one call with "399p". What else would you try it with?
There was a problem hiding this comment.
I tested it with: 0, 00, 000, 01, 9, 58749 ...
| // d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer | ||
| // =============> write your answer here | ||
|
|
||
| // The value assigned to num is 1. This is because 1 is the last character in the string 61 |
There was a problem hiding this comment.
The value 1 is right, but have another look at why. remainingSeconds comes from seconds % 60 on line 12, not from taking the last character out of the string "61". What is 61 % 60, and is the result a string or a number? Answer e) has the same reasoning in it.
There was a problem hiding this comment.
61 % 60 is 61 divided by 60 which is 1(totalMinutes) and the leftover 1 assigned to remainingSeconds

Learners, PR Template
Self checklist
Task code
CYF-1053
Changelist
Code error fixed, debugged, and refactored as reqiured.