Skip to content

London | 26-ITP-Jan | Angela McLeary | Sprint 2 | Coursework/sprint 2#1110

Open
AngelaMcLeary wants to merge 17 commits intoCodeYourFuture:mainfrom
AngelaMcLeary:acoursework/sprint-2
Open

London | 26-ITP-Jan | Angela McLeary | Sprint 2 | Coursework/sprint 2#1110
AngelaMcLeary wants to merge 17 commits intoCodeYourFuture:mainfrom
AngelaMcLeary:acoursework/sprint-2

Conversation

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

It is about debugging and understanding how logic works.

@github-actions

This comment has been minimized.

@AngelaMcLeary AngelaMcLeary added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 28, 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 Feb 28, 2026
@AngelaMcLeary AngelaMcLeary changed the title London | 26-ITP-Jan | Angela McLeary | Sprint 3 | Coursework/sprint 2 London | 26-ITP-Jan | Angela McLeary | Sprint 2 | Coursework/sprint 2 Feb 28, 2026
@AngelaMcLeary AngelaMcLeary added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 28, 2026
@tee4tao tee4tao 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 1, 2026

function capitalise(str) {
let str = `${str[0].toUpperCase()}${str.slice(1)}`;
str = `${str[0].toUpperCase()}${str.slice(1)}`;
Copy link

Choose a reason for hiding this comment

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

In small examples this work, but do you think modifying function parameters is a good practice in larger codebases?

Could you rewrite this function in a way that avoids mutating the parameter entirely?

return `${decimalNumber * 100}%`;
}

console.log(decimalNumber); No newline at end of file
Copy link

Choose a reason for hiding this comment

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

Why do you still have this here?

Comment on lines +17 to +20
//the computer reads the values in the second console.log "multiply(10, 32)" and
//the first console.log only prints the value, it does not store it.
//the second console.log outputs the template literals and undefined
// as it has no value to reach.
Copy link

Choose a reason for hiding this comment

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

In your explanation, you mentioned that the second console.log outputs undefined 'as it has no value to reach.' You are exactly right! The technical term for this in JavaScript is an implicit return. If you don't explicitly tell a function what to return, JavaScript automatically forces it to return undefined behind the scenes. Keep up the great work!

Comment on lines +4 to +5
// So every console.log will print 3 every time. This function is not
// re-useable as it stands.
Copy link

Choose a reason for hiding this comment

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

Good point and observation. This function is not re-useable as it stands, functions should ideally be self-contained and reusable.

function calculateBMI(weight, height) {
// return the BMI of someone based off their weight and height
} No newline at end of file
return (weight/(Math.pow(height, 2))).toFixed(1);
Copy link

Choose a reason for hiding this comment

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

Using .toFixed() converts your datatype to String. How might you convert that final answer back into a true Number before returning it?

You used Math.pow(height, 2) to square the height, which is 100% correct. However, modern JavaScript has a shorthand operator for exponents that makes equations look a bit cleaner.

@tee4tao tee4tao 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 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants