Skip to content

Conversation

Fithi-Teklom
Copy link

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

@Fithi-Teklom Fithi-Teklom added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 15, 2025
@Fithi-Teklom Fithi-Teklom changed the title Manchester | 25-ITP-May | Fithi Teklom| Sprint 1 | Alarm Clock Manchester | 25-ITP-May | Fithi Teklom| Sprint 1 | Coursework Sprint 1 Oct 15, 2025
Copy link

@CameronDowner CameronDowner left a comment

Choose a reason for hiding this comment

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

Looking really good! Some additional questions to test & challenge your understanding 🙂

// Try logging the value of num and running the program several times to build an idea of what the program is doing
console.log(num);

// num is a random integer between minimum and maximum, including both endpoints.

Choose a reason for hiding this comment

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

What is the difference between an integer and decimal number?

Copy link
Author

Choose a reason for hiding this comment

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

Integer is a whole number(no fraction and no decimal). But Decimal number is a number with a ( . ), that can be fractional or decimal.

// Read the code and then answer the questions below

// a) How many function calls are there in this file? Write down all the lines where a function call is made
// There are 5 function calls. Number(), carPrice.replaceAll(),priceAfterOneYear.replaceAll(), console.log(),percentageChange(),

Choose a reason for hiding this comment

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

Is percentageChange() a function here?

Copy link
Author

Choose a reason for hiding this comment

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

No, but there are 2 Number functions. I have updated it in the exercise.

//const percentageChange = (priceDifference / carPrice) * 100;

// e) Describe what the expression Number(carPrice.replaceAll(",","")) is doing - what is the purpose of this expression?
// It replaces the number to a clean string.

Choose a reason for hiding this comment

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

Could you explain a bit more what you mean here?

Copy link
Author

Choose a reason for hiding this comment

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

I meant a string without unnecessary spaces, comma or underscore. Just the string as it is.


// c) Using documentation, explain what the expression movieLength % 60 represents
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Arithmetic_Operators
//Remainder assignment. Which means when 8784 seconds is divided by 60 it gives 24.

Choose a reason for hiding this comment

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

Could you clarify this?

8784 divided by 60 gives 146.4

Copy link
Author

Choose a reason for hiding this comment

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

I meant it gives a remainder value which is 24. So when 8784 is divided by 60 it gives 146 and a remainder of 24.

//Dividing that by 60 converts the remaining seconds into whole minutes.

// e) What do you think the variable result represents? Can you think of a better name for this variable?
//It represents movie duration. A better name can be formattedMovie.

Choose a reason for hiding this comment

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

Is there another variable name you could use here that gives even more context?

//It represents movie duration. A better name can be formattedMovie.

// f) Try experimenting with different values of movieLength. Will this code work for all values of movieLength? Explain your answer
// Mostly yes, but not good for fractional values, negative numbers and numbers less than 0, the leading 0 may not be displayed.

Choose a reason for hiding this comment

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

These are really good edge cases!

@CameronDowner CameronDowner 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. labels Oct 18, 2025
@CameronDowner
Copy link

I've just noticed you're missing exercise 3, could you also include this 🙂

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.

2 participants