Skip to content

Birmingham | 26-ITP-May | Ogbemi Mene | Sprint 2 | coursework #1439

Open
meneogbemi42-bit wants to merge 18 commits into
CodeYourFuture:mainfrom
meneogbemi42-bit:coursework/sprint2
Open

Birmingham | 26-ITP-May | Ogbemi Mene | Sprint 2 | coursework #1439
meneogbemi42-bit wants to merge 18 commits into
CodeYourFuture:mainfrom
meneogbemi42-bit:coursework/sprint2

Conversation

@meneogbemi42-bit

@meneogbemi42-bit meneogbemi42-bit commented Jul 2, 2026

Copy link
Copy Markdown
  • [ x ] I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • [ x ] My changes meet the requirements of the task
  • [ x ] I have tested my changes
  • [ x ] My changes follow the style guide

This PR contains debugging, implementation, and interpretation work across multiple coding exercises focusing on function parameters, return values, and string manipulation in JavaScript.

@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@meneogbemi42-bit meneogbemi42-bit added 🏕 Priority Mandatory This work is expected Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Jul 2, 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 Jul 2, 2026
@github-actions

This comment has been minimized.

@meneogbemi42-bit meneogbemi42-bit changed the title Birmingham Coursework/sprint2 Birmingham | 26-ITP-May | Ogbemi Mene | Sprint 2 | Coursework/sprint2 Jul 2, 2026
@meneogbemi42-bit meneogbemi42-bit added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 2, 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 Jul 2, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@meneogbemi42-bit meneogbemi42-bit added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 2, 2026
@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 2, 2026
@github-actions

This comment has been minimized.

@meneogbemi42-bit meneogbemi42-bit added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 2, 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 Jul 2, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@meneogbemi42-bit meneogbemi42-bit changed the title Birmingham | 26-ITP-May | Ogbemi Mene | Sprint 2 | data testing Birmingham | 26-ITP-May | Ogbemi Mene | Sprint 2 | coursework Jul 2, 2026
@github-actions

This comment has been minimized.

@meneogbemi42-bit meneogbemi42-bit added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 2, 2026
@Liam310 Liam310 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 Jul 6, 2026

return `${str[0].toUpperCase()}${str.slice(1)}`;

}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Really good explanation of scope and variable declarations here, just wanted to highlight the extra if statement you added. Are you sure it handles the empty string case like you describe?

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.

this is the best explanation i could come up with.

By checking typeof str !== "string", you are asking: "If the input is anything other than a string, stop processing and just return the input exactly as it is." If you send a string: It skips the if block and proceeds to do the work.
If you send a number: The if condition is true, so it returns the number and ignores the rest of the function.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

So your understanding of what the if statement does (as you've explained here) is good, but that's not what you've said in the comments 🙂 You said:

the if condition i added is to ensure that if an empty string is passed to the function, it will return the empty string instead of throwing an error.

But as you have described, the if condition checks for the data type, not whether the string is empty. How would you check for that?

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.

yes, the initial statement was not correct, i looked at it critically a saw that this if statement will trow an error, because i did not add this ( | | ) operator, Because of the | | operator, if the string is empty, the function returns str. to handle it i will add || str.length === 0) to the if condition. and this will handle it.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please add this second condition then 🙂

Comment thread Sprint-2/2-mandatory-debug/1.js Outdated
// =============> the explanation:
// The function sum has a return statement before the addition operation, which causes the function to return undefined immediately.
// To fix this, the return statement should be placed after the addition operation.
// because the function is not a string i have to remove the backticks and use a normal string concatenation to print the result correctly.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

// because the function is not a string i have to remove the backticks and use a normal string concatenation to print the result correctly.

What happens if you tried to use the backticks here with a function that returns a number?

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.

If you use backticks with a function that returns a number, JavaScript will automatically convert that number into a string so it can be combined with the rest of your text. just wanted to indicate that i was not working with string functions

@Liam310 Liam310 Jul 10, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Right, I'm just trying to highlight why you changed

console.log(`The sum of 10 and 32 is ${sum(10, 32)}`);

To be

console.log(sum(10, 32));

These are the only backticks in this file that you removed. Why do that?

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.

When I am writing code , I often switch to the shorter version to keep the code block as clean as possible, but your original approach (using backticks) is actually better practice for real-world debugging because it makes the console output much easier to read and understand.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I understand - either console.log is fine! They both serve the same purpose. To bring it back to my original comment, the thing you wrote:

because the function is not a string i have to remove the backticks and use a normal string concatenation to print the result correctly.

Doesn't really make sense here. The function doesn't contain backticks or string concatenation; the only backticks you removed you were in the console.log which doesn't have any bearing on the function itself or how it works. You clearly understand the function's issue and how to solve! I just think this comment serves to only confuse things and doesn't really add anything. You can remove it!

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.

ok thanks

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.

i have removed it

Comment thread Sprint-2/3-mandatory-implement/3-to-pounds.js
Comment thread Sprint-2/5-stretch-extend/format-time.js Outdated
@Liam310

Liam310 commented Jul 6, 2026

Copy link
Copy Markdown

Really nice explanations Ogbemi! Just a few comments but good work overall.

@Liam310 Liam310 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 Jul 7, 2026
@meneogbemi42-bit meneogbemi42-bit 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 Jul 7, 2026
@Liam310 Liam310 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 Jul 10, 2026
@meneogbemi42-bit meneogbemi42-bit added 🏕 Priority Mandatory This work is expected 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 Jul 10, 2026
@Liam310 Liam310 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 Jul 10, 2026
Moved the return statement to after the addition operation to ensure the function returns the correct result.
@meneogbemi42-bit meneogbemi42-bit 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 Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Structuring-And-Testing-Data The name of the module. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 🏕 Priority Mandatory This work is expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants