Skip to content

Conversation

@Iswanna
Copy link

@Iswanna Iswanna commented Oct 10, 2025

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

In this pull request, I worked through the tasks in the following directories:

  • 1-key-exercises
  • 2-mandatory-errors
  • 3-mandatory-interpret

For the 1-key-exercises, I completed short JavaScript programs and tasks. When I came across syntax or code I didn’t recognize, I looked it up in the documentation to understand how it worked.

For the 2-mandatory-errors exercises, I ran each file in the errors directory using Node.js to identify and understand the error messages. I then explained the cause of each error.

For the 3-mandatory-interpret exercises, I analysed small JavaScript programs that included unfamiliar syntax and operators. I used the MDN Web Docs to look up and understand new concepts, and used console.log() statements to test and interpret variable values.

Questions

Hi. Please could you review my PR? I’d really appreciate your feedback.

@Iswanna Iswanna added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 10, 2025
@tenzyns tenzyns added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 10, 2025
const ext = ;
const dir = filePath.slice(0,lastSlashIndex) ;
console.log(dir);
const ext = filePath.slice(lastSlashIndex + 1) ;
Copy link

Choose a reason for hiding this comment

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

Here the aim is the store the ext part. if you look at the diagram, the ext part doesn't include the string 'file'. so how would you store just the ext part?

Copy link
Author

@Iswanna Iswanna Oct 12, 2025

Choose a reason for hiding this comment

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

Hi @tenzyns.
Thank you for the feedback. I’ve updated the code to extract only the extension part by slicing from the last dot to the end and storing the value in the ext variable. The updated code is shown below:

const lastDotIndex = base.lastIndexOf(".");
const ext = base.slice(lastDotIndex) ;

// For example, 37.6 becomes 37, and 99.9 becomes 99.

// + minimum
// Variable minimum is added to the expression "Math.floor(Math.random() * (maximum - minimum + 1))" and the the value is stored inside the variable num
Copy link

Choose a reason for hiding this comment

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

Why do you think the variable minimum is added to the expression?

Copy link
Author

@Iswanna Iswanna Oct 12, 2025

Choose a reason for hiding this comment

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

Hi @tenzyns.
I added the variable minimum to the expression inorder to shift the range so the random number starts from the minimum value instead of 0. Without it, the result would be between 0 and (maximum - minimum), but adding minimum ensures it’s between minimum and maximum (inclusive).

// This error means that Javascript was unable to read the code because a variable name cannot start with a number
// I can fix this code by removing the numbers from the start of the variable name

const HourClockTime = "20:53";
Copy link

Choose a reason for hiding this comment

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

It's not incorrect but to keep in mind, its convention to capitalise variables which are class name and constructor name in Javascript.

Copy link
Author

Choose a reason for hiding this comment

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

Hi @tenzyns.
Thank you for the feedback! I’ll follow the convention and use camelCase for regular variables going forward.
I’ve also updated my code by renaming the two variables using camelCase.

@tenzyns tenzyns added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Oct 10, 2025
@Iswanna Iswanna added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 12, 2025
@tenzyns
Copy link

tenzyns commented Oct 12, 2025

Nice work @Iswanna

@tenzyns tenzyns added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 12, 2025
@Iswanna
Copy link
Author

Iswanna commented Oct 12, 2025

Nice work @Iswanna

Thank you so much for taking the time to review my pull request @tenzyns

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 all review comments have been addressed. Module-Structuring-And-Testing-Data The name of the module. 📅 Sprint 1 Assigned during Sprint 1 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants