Skip to content

London | 26-ITP-May | Yonatan Teklemariam | Sprint 2 | Coursework#1379

Open
Yonatanteklemariam wants to merge 14 commits into
CodeYourFuture:mainfrom
Yonatanteklemariam:coursework/Sprint-2-clean
Open

London | 26-ITP-May | Yonatan Teklemariam | Sprint 2 | Coursework#1379
Yonatanteklemariam wants to merge 14 commits into
CodeYourFuture:mainfrom
Yonatanteklemariam:coursework/Sprint-2-clean

Conversation

@Yonatanteklemariam

Copy link
Copy Markdown

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

debugged the code and corrected the function along with the parameters

Questions

Renamed variable 'str' to 'result' to avoid redeclaration error.
Fixed variable declaration issue in convertToPercentage function and updated console log.
Commented out the incorrect code and added a note about the declaration error.
Corrected the function parameter and added comments explaining the error.
@Yonatanteklemariam Yonatanteklemariam added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 22, 2026
The multiply function now returns the product of a and b, fixing the undefined output issue.
Fixed the sum function to return the correct value of a + b.
Refactor getLastDigit function to accept a parameter and update comments for clarity.
Implement snakeCaseString function to convert strings to snake case and uppercase.
Implemented a function to convert pence to pounds format.

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

Most of the code looks good.

Comment on lines 22 to +32
// Finally, correct the code to fix the problem
// =============> write your new code here
/* ===========> function convertToPercentage(decimalNumber) {
let decimalNum = 0.5;
const percentage = `${decimalNum * 100}%`;


return percentage;
}
const result = convertToPercentage();
console.log(result);
*/

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.

You get rid of the syntax error but the function still does not work quite correctly.
I expect convertToPercentage(0.1) to return "10%", but it returns "50%" instead.

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 i worked it out as well and it did the same because decimalNumber argument has already been defined inside the function as 0.5 and for that matter, it returned 50%. but here i've corrected the function and can return any decimal number passed through it as argument

@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 Jun 27, 2026
Refactor convertToPercentage function to avoid redeclaration and return correct percentage.
@Yonatanteklemariam Yonatanteklemariam 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 Jun 27, 2026
@cjyuan

cjyuan commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

Changes look good.

@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. labels Jun 28, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants