Conversation
abdishakoor-dev
left a comment
There was a problem hiding this comment.
Your answers are clear and well explained. Your breakdown of line 4 in 2-time-format.js is very good, with real numbers at each step. 3-to-pounds.js step 3 also has good examples, with 11 and 1.
I have left a hint on each line. Please fix these things before I can mark this Complete:
-
1-percentage-change.jsa) and2-time-format.jsb): both say there are no function calls. But both files have some. A function call is a function name followed by brackets, likename(...). For example,console.log(...)andNumber(...)are function calls. Look for this pattern in each file, and count them again. -
3-paths.jsline 21:extonly works when the extension has 3 letters. The code on lines 13 and 14 shows you a better way. See my reply on line 21. -
4-random.js: say whatnumis at the end. -
2-mandatory-errors:1.jshas no explanation.2.jsand4.jsneed the error type (SyntaxError, TypeError or ReferenceError). In3.js, change line 2, not line 1. -
2-time-format.js: answers c) and f). -
"My changes follow the style guide" is on your checklist, and consistent formatting is part of it. The tool that does it is called Prettier. It sets spacing and indentation to one agreed style. Then a reviewer only sees the changes you meant to make. Right now all the files you changed fail that check.
Prettier comes with the CYF extension pack from onboarding. If you are not sure you have it, open VS Code, go to Extensions, and search for CodeYourFuture Extension Pack: https://marketplace.visualstudio.com/items?itemName=CodeYourFuture.cyf-extension-pack
Then open each file you changed, right click in the editor, and choose Format Document. Pick Prettier if VS Code asks. Save, commit and push. To format every time you save, follow the format on save steps here: https://github.com/CodeYourFuture/Module-JavaScript-Fundamentals/blob/main/practical_guide.md
Add the Needs Review label again once you have pushed.
|
|
||
| const age = 33; | ||
| let age = 33; | ||
| age = age + 1; |
There was a problem hiding this comment.
The fix works. But the exercise also asks you to explain the error. Please add a comment with the error type and the reason.
The prep shows three error types:
- SyntaxError: the code breaks a rule of JavaScript, so no line runs.
- TypeError: the code tries to do something that value cannot do.
- ReferenceError: the code uses a variable it cannot reach.
When you ran the original file, node's error message started with one of these. Which one was it? And why does let fix it?
| const cityOfBirth = "Bolton"; | ||
| console.log(`I was born in ${cityOfBirth}`); | ||
|
|
||
| // Java script cannot access the variable cityOfBirth before initialization. No newline at end of file |
There was a problem hiding this comment.
Your reason is right, and the fix works. Please also write the error type.
The prep shows three error types:
- SyntaxError: the code breaks a rule of JavaScript, so no line runs.
- TypeError: the code tries to do something that value cannot do.
- ReferenceError: the code uses a variable it cannot reach.
When you ran the original file, node's error message started with one of these. Which one was it?
| const twelveHourClockTime = "8:53pm"; | ||
| const twentyFourHourClockTime = "20:53"; | ||
|
|
||
| // Variable names cannot start with a number in Java Script. No newline at end of file |
There was a problem hiding this comment.
Your reason is right, and the new names work. Please also write the error type.
The prep shows three error types:
- SyntaxError: the code breaks a rule of JavaScript, so no line runs.
- TypeError: the code tries to do something that value cannot do.
- ReferenceError: the code uses a variable it cannot reach.
When you ran the original file, node's error message started with one of these. Which one was it?
|
|
||
| // b) There are no function calls. | ||
|
|
||
| // c) The reminder (%) operator returns the reminder left over when one operand is divided by a second operand. |
There was a problem hiding this comment.
This is what % does in general. In this program, movieLength % 60 gives 24. Are those 24 seconds, minutes or hours? Write what the 24 means here.
|
|
||
| // e) result represents the length of the movie in hours, minutes, and seconds format. It can be renamed movieDuration. | ||
|
|
||
| // f) When displaying single digit hour, minute, or seconds it doesn't include 0 in front of the digit. No newline at end of file |
There was a problem hiding this comment.
Good, that is one problem. Now try -90 and 90.5 as movieLength. What does the program print each time? Add what you see to f).
abdishakoor-dev
left a comment
There was a problem hiding this comment.
3-paths.js and 4-random.js are fixed now. Thanks.
Some changes you mention in the threads are not in the PR. For example, 2-time-format.js b) still says "There are no function calls". And 3.js has not changed since 16 September. Maybe the files were not saved, or not pushed. In VS Code, a dot on a file tab means the file is not saved.
Still to do:
1-percentage-change.jsa): your lines are right. The question also asks how many calls. Line 4 has two. Write the total.2-time-format.jsb): line 10 hasconsole.log(result). That is a function call. So the answer is 1.2-mandatory-errors/3.js: go back to your first version on line 2, as in my thread reply. Line 1 stays a number.2-mandatory-errors/1.js,2.jsand4.js: add the error type to each. See my comments on those files.2-time-format.jsc) and f): see my comments on lines 33 and 39.- Prettier: most of the files you changed still fail the check. Format each one, then push. Format on save stops this coming back: https://github.com/CodeYourFuture/Module-JavaScript-Fundamentals/blob/main/practical_guide.md
Add the Needs Review label again once you have pushed.
|
@abdishakoor-dev Everything is updated now. |
|
The files changed in this PR don't match what is expected for this task. Please check that you committed the right files for the task, and that there are no accidentally committed files from other sprints. Please review the 'files changed' tab at the top of the page. Here is an example of a file that has been changed on this branch but shouldn't be: If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above. |
|
The files changed in this PR don't match what is expected for this task. Please check that you committed the right files for the task, and that there are no accidentally committed files from other sprints. Please review the 'files changed' tab at the top of the page. Here is an example of a file that has been changed on this branch but shouldn't be: If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed). If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above. |
Learners, PR Template
Self checklist
Task code
CYF-1039
Changelist
Using documentations errors explained fixed. Program explained step by step.