Skip to content

London | 26-ITP-Sep | Alan Mak | Sprint 3 | Module-JavaScript-Fundamentals Coursework - #1619

Open
AlanGit-debug2604 wants to merge 26 commits into
CodeYourFuture:mainfrom
AlanGit-debug2604:acoursework/sprint-3
Open

AlanGit-debug2604 wants to merge 26 commits into
CodeYourFuture:mainfrom
AlanGit-debug2604:acoursework/sprint-3

Conversation

@AlanGit-debug2604

@AlanGit-debug2604 AlanGit-debug2604 commented Sep 28, 2026 •

Copy link
Copy Markdown

Alan Mak, Sprint-3 PR

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

CYF-1053

CYF-1053

Changelist

Coursework for Sprint-3 covering Functions, Scoping, passing arguments value to parameter.

Questions

In 5-stretch-extend, Further edge cases where input hours >36. Because of this, I m wondering if it is more preferable to leverage on something similar from time-format.js, and build on const hours_in_day = 24, then using remainder..etc, rather than using if.

debug2604 and others added 20 commits September 24, 2026 21:56
…to convert strings to UPPER_SNAKE_CASE format
…nvert whole pence string to formatted pounds
…Pound function for clarity; time-format.js updated comments with answers to questions
…nputs over 24 and update test cases for clarity, also handle minutes input other than :00
@github-actions

This comment has been minimized.

@netlify

netlify Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for cyf-onboarding-module ready!

Name Link
🔨 Latest commit fa9defb
🔍 Latest deploy log https://app.netlify.com/projects/cyf-onboarding-module/deploys/6abe6dbd1b05730007204d92
😎 Deploy Preview https://deploy-preview-1619--cyf-onboarding-module.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
2 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 86 (no change from production)
PWA: -
View the detailed breakdown and full score reports
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@AlanGit-debug2604 AlanGit-debug2604 added 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Sep 28, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 28, 2026
@github-actions

This comment has been minimized.

@AlanGit-debug2604 AlanGit-debug2604 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 28, 2026
@AlanGit-debug2604 AlanGit-debug2604 changed the title London | 26-ITP-Sep | Alan Mak | Sprint 3 | Module-JavaScript-Fundamentals London | 26-ITP-Sep | Alan Mak | Sprint 3 | Module-JavaScript-Fundamentals Coursework Sep 28, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In 5-stretch-extend, Further edge cases where input hours >36. Because of this, I m wondering if it is more preferable to leverage on something similar from time-format.js, and build on const hours_in_day = 24, then using remainder..etc, rather than using if.

The spec does not mention what to do for hours > 24. So you can decide what to do when that happened.

Without seeing the actual code, I could not compare the approaches you were describing.

Comment thread Sprint-3/1-key-errors/0.js
Comment thread Sprint-3/3-mandatory-implement/1-bmi.js
Comment thread Sprint-3/5-stretch-extend/format-time.js Outdated
Comment on lines +8 to +9
if (hours > 24) {
return `${hours - 24}:${minutes} am +1`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What is the meaning of +1?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The +1 is shorthand for "plus one day" meaning the time falls on the next day


console.log(formatAs12HourClock("08:01"));
console.log(formatAs12HourClock("23:55"));
console.log(formatAs12HourClock("25:01"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What output do you expect from console.log(formatAs12HourClock("00:01"))

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch thanks! Fixed to ensure leading zeros for single-digit hours, and to ensure correct am/pm representation

@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 Sep 29, 2026
@AlanGit-debug2604 AlanGit-debug2604 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 29, 2026

@cjyuan cjyuan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes look good.

Thanks for responding to all comments.

Since "stretch" exercise is optional, I will mark this PR as "Complete" first. You could continue improving the function in the stretch exercise if time permits.

Comment on lines +41 to +42
const currentOutput4 = formatAs12HourClock("00:01");
const targetOutput4 = "00:01 am";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

In 12-hour clock, 00:01 should be converted to "12:01 am".

Comment on lines +10 to +13
} else if (hours > 22) {
return `${hours - 12}:${minutes} pm`;
} else if (hours > 12) {
return `0${hours - 12}:${minutes} pm`;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not wrong, but the code could be simplified by using the .padStart() method of String.

Another approach you could consider is:

  • Introduce variables to store the values needed to produce the resulting string
  • Compute the value of these variables
  • Produce the the resulting string from these variables (only one such statement is needed)

@cjyuan cjyuan 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 Sep 30, 2026
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 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants