Skip to content

London | 26-ITP-January | Damian Dunkley | Sprint 2 | coursework/sprint-2#1012

Open
DamianDL wants to merge 6 commits intoCodeYourFuture:mainfrom
DamianDL:coursework/sprint-2
Open

London | 26-ITP-January | Damian Dunkley | Sprint 2 | coursework/sprint-2#1012
DamianDL wants to merge 6 commits intoCodeYourFuture:mainfrom
DamianDL:coursework/sprint-2

Conversation

@DamianDL
Copy link

@DamianDL DamianDL commented Feb 21, 2026

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

Completion of Sprint 2 exercises

Questions

Please review changes to exercises?

@DamianDL DamianDL added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 2 Assigned during Sprint 2 of this module Submit:PR Module-Structuring-And-Testing-Data The name of the module. and removed Submit:PR labels Feb 21, 2026
@oyagbileoluwaseun oyagbileoluwaseun self-assigned this Mar 3, 2026
@oyagbileoluwaseun oyagbileoluwaseun 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 3, 2026
Copy link

@oyagbileoluwaseun oyagbileoluwaseun left a comment

Choose a reason for hiding this comment

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

You can make the few adjustments, especially in 1-key-errors, and it would be better.

// The error is occurring because we are trying to declare a variable 'str' inside the function that has the same name as the parameter 'str'.To fix this problem, create an variable with a new name Newstr . So we would change the line to: Newstr = `${str[0].toUpperCase()}${str.slice(1)}`;
// =============> write your new code here
function capitalise(str) {
let Newstr = `${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.

Hello Damian,

This is good work spotting the error, but do you know about the camelCase name convention? You can check that out to help improve your naming convention.

Copy link
Author

Choose a reason for hiding this comment

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

Hi Oyagbile- thanks for the review and feedback. New variable name changed from Newstr to newStr, to conform to camelCase naming convention. Thanks

// Finally, correct the code to fix the problem
// =============> write your new code here
function convertToPercentage(decimalNumber) {
const decimalNum = 0.5;

Choose a reason for hiding this comment

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

You successfully sorted the redeclaration error.


// =============> write your new code here

function square(num) {

Choose a reason for hiding this comment

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

This is well done.


// =============> write your explanation here

// The error is occurring because the function 'multiply' is not returning any value. In JavaScript, if a function does not explicitly return a value, it returns 'undefined' by default. To fix this problem, we need to add a return statement to the function that returns the result of multiplying 'a' and 'b'. For example, we could change the line to: return a * b; so that the function will return the correct result when called.

Choose a reason for hiding this comment

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

Good.


// Explain why the output is the way it is
// =============> write your explanation here
// The function getLastDigit is not taking any parameters, so it always returns the last digit of the global variable 'num', which is 103. The function should take a number as a parameter and return the last digit of that number.

Choose a reason for hiding this comment

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

The function will ignore the arguments passed in and always return the last digit of the global variable num.

function calculateBMI(weight, height) {
// return the BMI of someone based off their weight and height
} No newline at end of file
const bmi = weight / (height ^2);

Choose a reason for hiding this comment

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

Do you think this is the most optimised way to do an exponentiation?

If not leyt me know how you would fix it.

penceString.length - 1
);

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

Choose a reason for hiding this comment

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

This is good.

@@ -10,6 +10,10 @@ function formatTimeDisplay(seconds) {

return `${pad(totalHours)}:${pad(remainingMinutes)}:${pad(remainingSeconds)}`;
}

Choose a reason for hiding this comment

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

Well done.

@oyagbileoluwaseun oyagbileoluwaseun 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 3, 2026
@DamianDL DamianDL 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 3, 2026
@oyagbileoluwaseun oyagbileoluwaseun 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 3, 2026
// =============> write your explanation here
// The error is occurring because we are trying to declare a variable 'str' inside the function that has the same name as the parameter 'str'.To fix this problem, create an variable with a new name Newstr . So we would change the line to: Newstr = `${str[0].toUpperCase()}${str.slice(1)}`;
// =============> write your new code here
function capitalise(str) {

Choose a reason for hiding this comment

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

Well done.


// =============> write your explanation here
// The error is occurring because we are trying to declare a variable 'str' inside the function that has the same name as the parameter 'str'.To fix this problem, create an variable with a new name Newstr . So we would change the line to: Newstr = `${str[0].toUpperCase()}${str.slice(1)}`;
// =============> write your new code here

Choose a reason for hiding this comment

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

This is good.

@oyagbileoluwaseun oyagbileoluwaseun added 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. labels Mar 3, 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. Module-Structuring-And-Testing-Data The name of the module. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants