Skip to content

Conversation

@Christelle-b
Copy link

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 COHORT_NAME | FIRST_NAME LAST_NAME | REPO_NAME | WEEK
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@Christelle-b Christelle-b added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 15, 2025
@Christelle-b Christelle-b changed the title Coursework/sprint 1 Coursework/ Module-STructure-and-Testing / sprint 1 Feb 15, 2025
@cjyuan cjyuan added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Feb 22, 2025
Copy link
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Good job! You seem to understand the code well.

Some descriptions/explanations could use some polishing.

Comment on lines +11 to +13
// Here, Math.rondom creates a random number between 0 to 1 and Math.floor rounds donw to the nearest integer.
// When creating a random number between 0 and 1, we will multiply it by the (100 - 1 + 1), then round it down to the nearest integer
// Then add all of that to 1.
Copy link
Contributor

Choose a reason for hiding this comment

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

The phrase "between 0 and 1" alone is not precise enough in program specification because
it does not state clearly whether 0 and 1 are included in the range. Can Math.random() return 0 or 1?

Can you explain the purpose of multiplying the value of Math.random() by (maximum - minimum + 1), and the purpose of ... + minimum in the expression?

What is the range of values that could be assigned to num?

Comment on lines +1 to +2
const HourClockTime = "20:53";
const hourClockTime = "08:53"; No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

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

Having two variable names different only by one character can be confusing. Also, it is a common practice to start a variable name by a lowercase letter.

Can you think of some better names for them?

Comment on lines +15 to +16
//There are two function calls here. replaceAll and console.log

Copy link
Contributor

Choose a reason for hiding this comment

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

There are more than two function calls. :)

Note: foo(bar()) would be considered as two function calls in which bar() is called first and its return value is passed as a parameter to foo().

// Line 1, line 2, line 7 and line 8 have variable declarations

// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
//This expression removes the comma in the price from 10,000 to 10000
Copy link
Contributor

Choose a reason for hiding this comment

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

If carPrice is "10,000", then carPrice.replaceAll(",","") returns "10000". What does Number(...) do?

// % is a remainder operator which will do movieLength / 60 and we will consider the remainder of this operation

// d) Interpret line 4, what does the expression assigned to totalMinutes mean?
// In line 4 we are declaring the totalMinutes. we have the remainingSeconds which is 24. Then we will do ((8784 - 24) /60) = 146
Copy link
Contributor

Choose a reason for hiding this comment

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

So what does the value 146 represents?

// In line 4 we are declaring the totalMinutes. we have the remainingSeconds which is 24. Then we will do ((8784 - 24) /60) = 146

// e) What do you think the variable result represents? Can you think of a better name for this variable?
// The variable result shows the total remaining duration of a movie in terms of hours, minutes and seconds
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you missed the second question at line 27: Can you think of a better name for this variable?

Answer the following questions:

What does `console` store?
Answer: Console stores a lot of objects like assert, clear, error, info, warn, log, debug and more.
Copy link
Contributor

Choose a reason for hiding this comment

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

Note: Those objects happened to be "Function objects" or functions. A function is a type of object in JavaScript.

@cjyuan cjyuan 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 Feb 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

3 participants