-
-
Notifications
You must be signed in to change notification settings - Fork 195
LONDON | May-2025 | Sisay Mehari | Module-Structuring-and-Testing-Data | Sprint-1 #505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explanation is clear. Good job.
I only have a few suggestions and comments.
Sprint-1/1-key-exercises/1-count.js
Outdated
//Line 3 is doing: - its reads the current value of count (which is 0), | ||
// then it adds 1 to that value (0 + 1 = 1) | ||
// then, it reassigns that result (1) back into count variable. | ||
// The = symbol is the assignment operator, Take the value on the right side, and store it into the variable on the left side. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Operation like count = count + 1
is very common in programming, and there is a programming term describing such operation.
Can you find out what one-word programming term describes the operation on line 3?
const ext = ; | ||
|
||
const dir = filePath.slice(0, lastSlashIndex); | ||
const ext = base.slice(dotIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is dotIndex
?
Sprint-1/1-key-exercises/4-random.js
Outdated
// It will help to think about the order in which expressions are evaluated | ||
// Try logging the value of num and running the program several times to build an idea of what the program is doing | ||
//const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum; | ||
//This line generates a random integer between minimum and maximum, inclusive. Here's a breakdown: | ||
//Math.random() returns a decimal between 0 (inclusive) and 1 (exclusive). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also use the concise and precise interval notation to describe a range of values.
For example, we can say, "Math.random()
returns a decimal in the interval [0, 1)
"
// Line 5: | ||
// priceAfterOneYear.replaceAll(",", "") → Calls the replaceAll() method on priceAfterOneYear. | ||
// Number(...) → Converts the result to a number using the Number() function. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 6 should have replaced line 5.
*/ | ||
// The variable result represents the movie length formatted as a string in hh:mm:ss (hours, minutes, seconds) format. | ||
// A better name for this variable could be: | ||
// movieDurationFormatted (or movieTimeFormatted) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Placing the adjective "formatted" in front of the noun "MovieDuration" would probably make the variable name sound more natural.
// Rationale: In UK currency, the last two digits represent pence, and the digits before that represent pounds. | ||
// 5. const pence = paddedPenceNumberString.substring(paddedPenceNumberString.length - 2).padEnd(2, "0"); | ||
// This line extracts the last 2 characters as the pence part. | ||
// If for any reason it's shorter than 2 digits, it adds a "0" to the end to ensure the format is correct. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What reason would it be?
Do we really need .padEnd(2, "0")
in this script?
Thank you so much for the thorough feedback! I've addressed all the points you raised. Looking forward to your review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good.
In addition to making changes, it is a common practice to also leave a response in the comment threads. Doing so makes it easier for all parties to track the discussion. You can try the approach in future PRs.
If you are up to more challenges, you can look up "best practice to respond to inline comments in a pull request", and then practice what you find in future PRs.
Thanks so much for the review and for letting me know the changes look good! I really appreciate the advice on responding to inline comments in future PRs – that makes a lot of sense for tracking discussions, and I'll definitely adopt that practice going forward. Thanks again for all your help! |
Learners, PR Template
Self checklist
Changelist
✅ Completed Exercises section: wrote small JavaScript programs and used MDN documentation to understand unfamiliar syntax
✅ Resolved all errors in the Errors section: ran files with Node.js... interpreted the error messages, and fixed the bugs using error documentation
✅ Interpreted and analyzed larger programs in the Interpret section: used console.log and MDN to understand syntax, operators, and functions
✅ Explored the Stretch section: reflected on key concepts and experimented with browser tools like the Chrome console.
Questions
None at the moment.