London | 26-ITP-May | Gideon Defar | Sprint 1 | Coursework#1553
London | 26-ITP-May | Gideon Defar | Sprint 1 | Coursework#1553gideondefar wants to merge 7 commits into
Conversation
| // This should produce the string "CKJ", but you must not write the characters C, K, or J in the code of your solution. | ||
|
|
||
| let initials = ``; | ||
| let initials = firstName[0]+ middleName[0]+ lastName[0]; |
There was a problem hiding this comment.
Could we keep the spacing around the + operators consistent here to improve readability?
| const ext = ; | ||
|
|
||
| const dir = filePath.slice(0, lastSlashIndex); | ||
| const ext = filePath.slice(lastDotIndex); |
There was a problem hiding this comment.
It looks like lastDotIndex has not been defined before it is used here.
| const 12HourClockTime = "8:53pm"; | ||
| const 24hourClockTime = "20:53"; | ||
| const HourClockTime = "8:53pm"; | ||
| const hourClockTime = "20:53"; |
There was a problem hiding this comment.
Could we name these variables more consistently and make the time format clear in each name?
|
|
||
| carPrice = Number(carPrice.replaceAll(",", "")); | ||
| priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")); | ||
| //priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")); |
There was a problem hiding this comment.
Generally it’s good practice to remove commented-out code once it’s no longer needed. It helps keep the code clean and makes it easier for others to read.
| b) The uncaught syntax error is coming from line 5. The error occurs because there is a missing comma in the replaceAll method. | ||
| It should be carPrice.replaceAll(",", "") instead of carPrice.replaceAll("," ""). To fix this, add the missing comma. | ||
| c) The variable reassignment statements are on lines 4 and 5, where carPrice and priceAfterOneYear are being reassigned to their numeric values. | ||
| d) The variable declarations are on lines 1 and 2, where carPrice and priceAfterOneYear are declared using the let keyword. |
There was a problem hiding this comment.
How would you categorise const declarations? Would you consider them variables, values or something else?
|
|
||
| /* | ||
| a) There are two functions Line 4 & 5: | ||
| for eg, The expression Number(carPrice.replaceAll(",","")) is doing the following: |
There was a problem hiding this comment.
Take another look at the function calls in this file. How many function calls are there in total?
|
I believe 0.js and 3.js in the mandatory errors section also require a solution. I also noticed that not all of the files run without errors. As a general practice, it’s worth running each file before pushing your changes to make sure there are no syntax or runtime errors. |
Self checklist
Changelist
In this PR, I have completed the required Sprint 1 coursework exercises.
Questions
How do you recommend formatting long multi-line explanations or breakdowns for formulas in the code? Is a detailed block comment preferred over individual single-line comments according to the style guide?