Skip to content

London | 26-Jan-ITP | Shuheda Begum | Sprint 2 | Coursework#1070

Open
codebyshay wants to merge 10 commits intoCodeYourFuture:mainfrom
codebyshay:Sprint-2
Open

London | 26-Jan-ITP | Shuheda Begum | Sprint 2 | Coursework#1070
codebyshay wants to merge 10 commits intoCodeYourFuture:mainfrom
codebyshay:Sprint-2

Conversation

@codebyshay
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

Completed all task required for Sprint 2

Questions

No questions.

@codebyshay codebyshay 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. labels Feb 25, 2026
I added the description the term increment
Restored 3.js to original text and made a prediction about the use of slice
I updated the code and ran it to test. The code worked and logged the last for digits of the card, 4213.
@codebyshay codebyshay changed the title London | 26-ITP-Feb | Shuheda Begum | Sprint 2 | Coursework London | 26-Jan-ITP | Shuheda Begum | Sprint 2 | Coursework Mar 5, 2026
Comment on lines -9 to 33
return str;
if (!str) return str; // handles empty string
return str[0].toUpperCase() + str.slice(1);
}

Choose a reason for hiding this comment

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

Good thinking to consider handling the empty string error.

Copy link
Author

Choose a reason for hiding this comment

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

Thank you :)

Comment on lines +11 to +12
// Write your explanation here
// When JavaScript sees the 'return' statement, it immediately stopd the function.

Choose a reason for hiding this comment

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

Yes, this is correct. You can read more on the exact operation; it is called in JavaScript. I man the termination of the function when the return keyword appears on its own line

Copy link
Author

Choose a reason for hiding this comment

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

Ok, will do. Thank you.

@Theoreoluwa Theoreoluwa added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 7, 2026
Comment on lines +40 to +58
function toPounds(penceString) {
const penceStringWithoutTrailingP = penceString.substring(
0,
penceString.length - 1
);

const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0");

const pounds = paddedPenceNumberString.substring(
0,
paddedPenceNumberString.length - 2
);

const pence = paddedPenceNumberString
.substring(paddedPenceNumberString.length - 2)
.padEnd(2, "0");

return `£${pounds}.${pence}`;
}

Choose a reason for hiding this comment

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

I understand you used the context of the code in the previous sprint, but this code could have been written in a much cleaner way by using some other functions to perform some conversions to the string. You can have a read on that as you progress.

`current output: ${currentOutput2}, target output: ${targetOutput2}`
);
//testing the function with various inputs.
console.log(formatAs12HourClock("08:00")); // 08:00 am

Choose a reason for hiding this comment

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

You need to write tests for various time formats. Unit tests, not console.log statements.

Copy link
Author

Choose a reason for hiding this comment

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

Hi, I will type the answer here. there seems to be a conflict with my work and when I'm saving the work and adding a commit, its not being pushed. I fear this may be due to an issue I had with the branch previously, which led me to starting over again. I had the same issue with Sprint One. I don't have the opportunity to start over again, as all work had to be submitted by yesterday, I will save my answers here. I hope that ok.

import { formatAs12HourClock } from "./formatAs12HourClock";

describe("formatAs12HourClock", () => {
test("formats morning time correctly", () => {
expect(formatAs12HourClock("08:00")).toBe("08:00 am");
});

test("formats evening time correctly", () => {
expect(formatAs12HourClock("23:00")).toBe("11:00 pm");
});

test("formats midnight correctly", () => {
expect(formatAs12HourClock("00:30")).toBe("12:30 am");
});

test("formats noon correctly", () => {
expect(formatAs12HourClock("12:15")).toBe("12:15 pm");
});

test("formats afternoon time correctly", () => {
expect(formatAs12HourClock("13:45")).toBe("01:45 pm");
});

test("formats late morning correctly", () => {
expect(formatAs12HourClock("11:59")).toBe("11:59 am");
});

test("formats exactly noon", () => {
expect(formatAs12HourClock("12:00")).toBe("12:00 pm");
});
});

Comment on lines +32 to +42
let [hours, minutes] = time.split(":");
hours = Number(hours);
let period = "am";

if (hours === 0) {
hours = 12; // midnight
} else if (hours === 12) {
period = "pm"; // noon
} else if (hours > 12) {
hours -= 12;
period = "pm";

Choose a reason for hiding this comment

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

Good solution to the bugs present in the code.

Copy link

@Theoreoluwa Theoreoluwa left a comment

Choose a reason for hiding this comment

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

Great job, Shuheda. Please look at my comments for better improvement. Keep going!

@Theoreoluwa Theoreoluwa added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Mar 7, 2026
@codebyshay
Copy link
Author

Thank you. I am having trouble saving and committing the changes, so have posted the answers to any questions on here. I hope that ok. Thank you.

@codebyshay codebyshay 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 Mar 9, 2026
@Theoreoluwa
Copy link

I’ll look through your comments. Your pr contains a conflict. That’s why it’s giving you issues when you want to commit and raise another pr.

@codebyshay
Copy link
Author

Yes, I'm not sure how to resolve it 🥺

@Theoreoluwa Theoreoluwa added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 11, 2026
@Theoreoluwa
Copy link

Theoreoluwa commented Mar 11, 2026

Looking at your answers, the test script you put in the comments were written using the Jest test suite. The code within the task gives you a little template on how to write tests as required for the function within the code. You should apply that as it helps solidify your idea of feature testing at this level. Rather than using a test suite for it.
Also, please try to look in your code and resolve the merge conflict. Mainly look at the task for the test code.

I'll be marking your work as done as the test task isn't entirely mandatory.

@Theoreoluwa Theoreoluwa 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 Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Mar 11, 2026
@codebyshay
Copy link
Author

Thank you so much. I will definitely look into what you said. Hopefully this weekend at class I can get some help with the conflict too.

Copy link

@Theoreoluwa Theoreoluwa 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, keep going.

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