Skip to content

Conversation

@anosidium
Copy link

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

I completed all the exercises.

Questions

I understand why TypeScript exists. JavaScript should have been a statically typed language.

@anosidium anosidium added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 22, 2025
@anosidium anosidium changed the title London | 25-ITP-September | Ammad Ur Rehman | Sprint 1 | 03 Complete Sprint 2 Coursework London | 25-ITP-September | Ammad Ur Rehman | Sprint 2 | 03 Complete Sprint 2 Coursework Oct 22, 2025
// c) What is the return value of pad is called for the first time?
// =============> write your answer here

// 00
Copy link
Contributor

Choose a reason for hiding this comment

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

A common convention for indicating that a value is a string is to enclose it in double quotes. For example, "00".

if (hours > 12) {
return `${hours - 12}:00 pm`;
let hours = Number(time.slice(0, 2));
const minutes = time.slice(3, 5);
Copy link
Contributor

Choose a reason for hiding this comment

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

We can also extract the last two characters as time.slice(-2).

@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
@anosidium anosidium added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 28, 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.

Changes look great! Well done.


return result;
}
return String(string).toUpperCase().replaceAll(" ", "_");
Copy link
Contributor

Choose a reason for hiding this comment

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

If string is already a string, we don't have to convert it to a string before using the string methods.

Copy link
Author

Choose a reason for hiding this comment

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

That's true but it didn't show up in the auto-complete, also given that JavaScript is a dynamically typed language without type safety, the parameter is any type, so I need to ensure that I am dealing with a String type otherwise it fails.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. 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 Oct 28, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants