Skip to content

Conversation

@Mahtem
Copy link

@Mahtem Mahtem commented Oct 24, 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

Completed course works of Sprint 2 from module structuring and testing data

Questions

Questions and blockers will be forwarded to slack.

@Mahtem Mahtem added 📅 Sprint 2 Assigned during Sprint 2 of this module 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. and removed Module-Structuring-And-Testing-Data The name of the module. labels Oct 24, 2025
suffix = "am";
}

hours = hours % 12 || 12; // convert 0 to 12, 13 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.

Can you explain how the expression hours % 12 || 12 convert 0 to 12 and 13 to 1?

Copy link
Author

Choose a reason for hiding this comment

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

Can you explain how the expression hours % 12 || 12 convert 0 to 12 and 13 to 1?

The expression converts 0 to 12, 13 to 1 and soon as it returns the remainder
for eg. taking 12/12 the remainder is 0
similarly if 13 is taken 13/12 , the remainder is 1, the operator || helps us to return the remainder after
a division operation.

Copy link
Contributor

Choose a reason for hiding this comment

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

My previous question might not be very clear. This is what I would like to find out:

Suppose expr1 and expr2 are some JavaScript expressions.
Can you explain how the expression expr1 || expr2 is evaluated 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.

My previous question might not be very clear. This is what I would like to find out:

Suppose expr1 and expr2 are some JavaScript expressions. Can you explain how the expression expr1 || expr2 is evaluated in JavaScript?

In Javascript in evaluating expr1 || expr2... expr1 is first evaluated if, expr1 happens to be false, expr2 gets evaluated.
In our case hours % 12 || 12, if hours %12 = 0 it might be midnight or miday so 12 is returned, other wise.. the remainder is returned. as 1.. 2... 3 ..

Copy link
Contributor

Choose a reason for hiding this comment

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

The description is not fully accurate but you probably have a good understanding of what is happening.

@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. labels Oct 25, 2025
@Mahtem Mahtem added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 13, 2025
@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 13, 2025
@Mahtem Mahtem added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 21, 2025
@cjyuan
Copy link
Contributor

cjyuan commented Nov 21, 2025

I was waiting for you to respond to this question:

image

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 21, 2025
@cjyuan cjyuan added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Nov 21, 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 all review comments have been addressed. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants