Skip to content

London | ITP-May-2025 | Halyna Kozlovska | Module-Structuring-and-Testing-Data | Sprint-1 #458

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

halyna-k
Copy link

@halyna-k halyna-k commented May 28, 2025

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with REGION | COHORT_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

  • Added answers and explanations for JavaScript tasks
  • Fixed syntax errors and renamed variables for clarity
  • Explained arithmetic and string operations step-by-step
  • Described how alert and prompt work in the Chrome console
  • Clarified the use of console object and its methods

Questions

Ask any questions you have for your reviewer.

halyna-k added 15 commits May 28, 2025 15:38
Edit comment to better describe assignment in line 3.
Add logic (create initials from first, middle, and last name) to generate and log initials.
Add logic to get dir and ext parts of file path
add random number generation between given min and max;
add step-by-step comments;
add console output;
comment out text to prevent SyntaxError
change 'const' declaration to 'let' to allow reassignment;
log the updated value
fix ReferenceError by declaring variable before use
fix TypeError by converting number to string before slicing
fix SyntaxError by renaming variables starting with numbers
add answers to all questions;
correct syntax error in replaceAll()
add answers to all questions;
fix variable name for clarity
add step-by-step explanation comments
add explanation for alert and prompt functions in Chrome console
add explanation of console object and its methods in Chrome DevTools
@halyna-k halyna-k added the Needs Review Participant to add when requesting review label May 28, 2025
@halyna-k halyna-k linked an issue May 28, 2025 that may be closed by this pull request
@halyna-k halyna-k added the 📅 Sprint 1 Assigned during Sprint 1 of this module label Jun 13, 2025
@Amundeep-Dhaliwal
Copy link

Hello Halyna, hope you are well.

Thanks for submitting this sprint 1 course work for the structuring & testing data module.
I liked how you used multiple commits for this work and the description of the PR is nice & concise.

Have a few comments:

// 1. Math.random() generates a decimal between 0 (inclusive) and 1 (exclusive)
// 2. Multiply by (maximum - minimum + 1) to scale to the desired range size
// 3. Math.floor() rounds down to get an integer from 0 up to range size minus 1
// 4. Adding minimum shifts the range so the lowest number is minimum, not zero
const num = Math.floor(Math.random() * (maximum - minimum + 1)) + minimum;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good explanation.
Extension question: what is the range of values that num can take?

Copy link
Author

@halyna-k halyna-k Jun 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Amundeep-Dhaliwal Thank you for your comment.
The value of num is an integer within the range from minimum to maximum, including both ends.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies, should have clarified.

What are the numeric values for the upper & lower limits for num?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Amundeep-Dhaliwal The lowest value num will be minimum, and the highest - maximum, so minimum ≤ num ≤ maximum. This line of code creates a random integer in that range by scaling a decimal from Math.random(), rounding down, and adding minimum.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Amundeep-Dhaliwal Did I answer your question?

Copy link

@Amundeep-Dhaliwal Amundeep-Dhaliwal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good Halyna, well done.

// Rename variables to valid identifiers because names cannot start with a number
const ClockTime_12Hour = "08:53";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good practice for naming variables. It can be quite difficult sometimes!

In JS it is common to use camel case when naming variables e.g. Time12Hour. In python it is common to use snake case when naming variables time_12_hour. It is good practice not to mix the two.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Amundeep-Dhaliwal Thank you. I agree and will keep this in mind for future naming.

// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?

// Firstly, carPrice.replaceAll(",", "") removes all commas from the string
// Then Number(...) converts the resulting string into a number type so it can be used in arithmetic

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These look good, thanks for the explanations.

// 1. The code correctly converts movieLength into hours, minutes, and seconds for positive values.
// 2. It doesn’t handle zero or negative values properly—these cases need extra checks.
// 3. Minutes and seconds may appear without leading zeros.
// 4. To improve add validation to handle zero or negative inputs gracefully.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These answers are good, it is nice to see that you are thinking about the edge cases for the code.

const pence = paddedPenceNumberString
.substring(paddedPenceNumberString.length - 2)
.padEnd(2, "0");

// 6. Output the formatted price in pounds and pence
console.log(`£${pounds}.${pence}`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This activity looks good.

@Amundeep-Dhaliwal Amundeep-Dhaliwal added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Jun 13, 2025
@cjyuan cjyuan removed their request for review June 13, 2025 17:16
@halyna-k halyna-k added Needs Review Participant to add when requesting review Reviewed Volunteer to add when completing a review and removed Reviewed Volunteer to add when completing a review Needs Review Participant to add when requesting review labels Jun 15, 2025
@halyna-k
Copy link
Author

@Amundeep-Dhaliwal Do I need to change the status to "Needs Review"?

@MorganDavid MorganDavid added Complete Volunteer to add when work is complete and review comments have been addressed and removed Reviewed Volunteer to add when completing a review labels Jun 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Complete Volunteer to add when work is complete and review comments have been addressed 📅 Sprint 1 Assigned during Sprint 1 of this module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

03 Complete Sprint 1 Coursework
3 participants