Skip to content

Cape Town | 26-ITP-May | Shafiek Walker | Sprint 1 | Coursework Exercises#1387

Open
shafiekwalker7861 wants to merge 8 commits into
CodeYourFuture:mainfrom
shafiekwalker7861:coursework/sprint-1
Open

Cape Town | 26-ITP-May | Shafiek Walker | Sprint 1 | Coursework Exercises#1387
shafiekwalker7861 wants to merge 8 commits into
CodeYourFuture:mainfrom
shafiekwalker7861:coursework/sprint-1

Conversation

@shafiekwalker7861

Copy link
Copy Markdown

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

Completed all Sprint 1 mandatory exercises, including implementing functions, interpreting code, and debugging. Tested all solutions before submitting.

@shafiekwalker7861 shafiekwalker7861 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Structuring-And-Testing-Data The name of the module. labels Jun 23, 2026
@Luro91 Luro91 added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Jun 24, 2026

@Luro91 Luro91 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Good job. Most exercisers are done. I have couple of comments on some of them

Comment thread Sprint-1/2-mandatory-errors/3.js Outdated
// The error is what I predicted. The slice method is not a function that can be used on numbers, only strings.

// Then try updating the expression last4Digits is assigned to, in order to get the correct value
const last4Digits = cardNumber % 10000;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This produces an error: "Uncaught SyntaxError: redeclaration of const last4Digits". HOw can you fix this?

Comment on lines +21 to +22
// The error was on line 5. The replaceAll() function call was missing the correct closing bracket/parenthesis.
// I fixed it by making the line: priceAfterOneYear = Number(priceAfterOneYear.replaceAll(",", ""));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The code is working now, but the change was not adding a brackent/parenthesis. What did change?



// d) Identify all the lines that are variable declarations
// line 1 and 2 are variable declarations because they are declared using the let keyword.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Are thre other variable declarations?


// e) What do you think the variable result represents? Can you think of a better name for this variable?
// The variable result represents the total length of the movie in hours, minutes, and seconds.
// A better name for this variable could be "movieDuration".

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

movieDuration is already better and clearer to understand. A common name for strings is to use the prefix formatted so formattedMovieLenght would also work

// A better name for this variable could be "movieDuration".

// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
// The code works for non-negative whole numbers. Negative or decimal values may produce incorrect or unexpected results.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What happens if the movieLength is 3665?

Comment thread 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

// Math.random() generates a random decimal,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What are the characteristics of the created float number?

Comment thread Sprint-1/1-key-exercises/4-random.js Outdated
// Try logging the value of num and running the program several times to build an idea of what the program is doing

// Math.random() generates a random decimal,
// Math.floor() rounds it down, and the expression produces a random whole number between 1 and 100. No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What is rounded down by Math.floor?

@Luro91 Luro91 added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Jun 24, 2026
@shafiekwalker7861

Copy link
Copy Markdown
Author

Hi @Luro91 , thanks for the feedback! I've addressed all of your comments:

Updated the explanation about the replaceAll() change.
Corrected the list of variable declarations.
Renamed the suggested variable to formattedMovieLength.
Tested movieLength = 3665 and updated my explanation.
Expanded the explanation of Math.random() and Math.floor().

I'd appreciate it if you could take another look. Thanks!

@shafiekwalker7861 shafiekwalker7861 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jun 24, 2026
@shafiekwalker7861

shafiekwalker7861 commented Jun 24, 2026 via email

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Structuring-And-Testing-Data The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants