Glasgow | JAN ITP-2026|Tuan Nguyen | Sprint 1 | Programming-fundamentals #1140
Glasgow | JAN ITP-2026|Tuan Nguyen | Sprint 1 | Programming-fundamentals #1140Jacknguyen4438 wants to merge 14 commits intoCodeYourFuture:mainfrom
Conversation
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.
cjyuan
left a comment
There was a problem hiding this comment.
I noticed some minor inconsistency formatting in the code/comments.
Have you installed prettier VSCode extension and enabled formatting on save/paste on VSCode as recommended in
https://github.com/CodeYourFuture/Module-Structuring-and-Testing-Data/blob/main/readme.md
| const pence = paddedPenceNumberString | ||
| .substring(paddedPenceNumberString.length - 2) | ||
| .padEnd(2, "0"); |
There was a problem hiding this comment.
Optional challenge question (no change required):
Could we expect this program to work as intended for any valid penceString if we deleted .padEnd(2, "0") from the code?
In other words, do we really need .padEnd(2, "0") in this script? Why?
|
@cjyuan Hello Yuan, thank you for the review you give me I am very grateful for the insight. I can see that there are many section I need to fix, so I would like to notify you that I have read the PR review and in the progress of fixing it. I understand that you are very busy with other PR as well and I was radio silent do to I am doing sprint 3 of module 2 at the moment. When I finish fixing and ready to be review I will mention you again thank you. |
|
|
||
| carPrice = Number(carPrice.replaceAll(",", "")); | ||
| priceAfterOneYear = Number(priceAfterOneYear.replaceAll("," "")); | ||
| priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", "")); |
There was a problem hiding this comment.
This is fine, but the link below is worth looking into. it's an abstraction over this and will probably serve you better in the long run:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt
There was a problem hiding this comment.
@ykamal Thank you for the link. I have read through and see that it indeed more organise then the current method I write in the code. I will try to used in my course work next time.
|
Hello @cjyuan I have make change base on the review suggestion from both you and ykamal. I am ready for another PR review and please if I need to make further change please let me know |
Sprint-1/1-key-exercises/3-paths.js
Outdated
| /* | ||
| const slashIndex = filePath.indexOf("/"); | ||
| const dir =filePath.slice(slashIndex + 0, 45) ; | ||
| const ext =filePath.slice(slashIndex + 49, 53); |
There was a problem hiding this comment.
Why keep this code? Best practice is to remove unused code to keep our code clean. And doing so also helps make code review easier.
There was a problem hiding this comment.
Thank you for point this out, I forgot to remove it when I fix the code. When you check again this line of code will be remove
Sprint-1/1-key-exercises/3-paths.js
Outdated
| let dirDirectory = filePath.slice(filePath.indexOf("/"),filePath.lastIndexOf("/")); | ||
| let extDirectory = filePath.slice(filePath.lastIndexOf("/")); | ||
| console.log(`The dir part of the file is ${dirDirectory}.`); | ||
| console.log(`The ext part of the file is ${extDirectory}.`); |
There was a problem hiding this comment.
Suppose filePath is "/tmp/file.txt". Based on your understanding of the anatomy of a file path on lines 3-8, can you tell which part of the file path is considered the dir part and which part of it is considered the ext part?
When you run your code, does your code output the values you expected?
There was a problem hiding this comment.
Thank you for the feed back I have check again and see some part that I write incorrect. My answer will be include when I finish and commit sync to github.
| let dirDirectory = filePath.slice(filePath.indexOf("/"),filePath.lastIndexOf(".")); | ||
| let extDirectory = filePath.slice(filePath.lastIndexOf(".")); | ||
| let baseDirectory = filePath.slice(filePath.lastIndexOf("/")); |
There was a problem hiding this comment.
The value of the "dir" part is still not correct.
Note:
- "dir" already stands for "directory"
- "ext" stands for extension (or file extension); it is not a directory
- "base" is also not necessary a directory
- The value of "base' has already been extracted on line 14. The value you extracted on line 23 is not quite correct (because your code includes the '/' character in the base).
Self checklist
Changelist
I have finish all 3 section from sprint 1:
If there is some exercise or course from sprint 1 I need to fix and improve please let me know.
Questions
Yes I see that in sprint 3 I need to make multiple PR request. Could I do that in the same branch for sprint 3 or I need to make like sub branch from sprint 3 branch in order to submit?