Skip to content

Manchester | 26-ITP-Jan | Liban Jama | Sprint 2 | Structuring and Testing Data#1101

Open
libanj0161 wants to merge 5 commits intoCodeYourFuture:mainfrom
libanj0161:coursework/sprint-2
Open

Manchester | 26-ITP-Jan | Liban Jama | Sprint 2 | Structuring and Testing Data#1101
libanj0161 wants to merge 5 commits intoCodeYourFuture:mainfrom
libanj0161:coursework/sprint-2

Conversation

@libanj0161
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 sprint 2 coursework.

Questions

N/A

@libanj0161 libanj0161 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 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
Comment on lines 5 to +7

// =============> write your prediction of the error here

// You can't put a number value into an argument.
Copy link

Choose a reason for hiding this comment

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

You mentioned 'argument', but the correct term for what goes inside the parentheses when you create a function is a Parameter. So, in this case it's a parameter.

Copy link

Choose a reason for hiding this comment

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

You've made a correction to the code but I can't see your explanation.

If you could kindly explain what's wrong with the original code and the what you did to correct it.

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

// =============> write your explanation here
// The sum of 10 and 32 is undefined. On line five the function has been exited because of the ; this because the function doesn't return anything.
Copy link

Choose a reason for hiding this comment

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

You mentioned the function exits specifically because of the ;

What happens if you delete that ; after return, but leave a + b on the next line? Give it a try!

(Hint: Look up Automatic Semicolon Insertion (ASI) in JavaScript to see why the line break itself. Any code below a return statement becomes "unreachable code".)

console.log("weight", weight);
console.log("height",height);

const heightSquared = (height * height).toFixed(2);
Copy link

Choose a reason for hiding this comment

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

Great job breaking the steps down! Quick question on this line: do you know what data type .toFixed() returns? Think about how that might affect the division operation on the next line. Is it better to round values in the middle of an equation, or only at the very end?


const heightSquared = (height * height).toFixed(2);
console.log("heightSquared",heightSquared);
const BMI = (weight / heightSquared).toFixed(2);
Copy link

Choose a reason for hiding this comment

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

Take another quick look at the task instructions regarding the decimal places. Are we returning the correct amount here? Also, keep in mind that .toFixed() will return a string. If the function is expected to return a Number, how could you convert it?

Comment on lines +19 to +20
console.log("weight", weight);
console.log("height",height);
Copy link

Choose a reason for hiding this comment

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

These logs are awesome for testing and debugging! However, for a clean final submission, what should we do with them?

Comment on lines +18 to +21
function makeUpperCaseSnakeCase(str){
const result = str.split(" ").join("_").toUpperCase(); //take str, and turn it into an array and then turn it back into a string with underscores then upper case it.
console.log("result",result);
}
Copy link

Choose a reason for hiding this comment

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

Your string manipulation logic is perfect! However, try running this exact code. You'll notice the final console.log at the bottom prints undefined. If a function calculates a value but doesn't explicitly hand it back to where it was called, what happens? How can we fix this?

Copy link

Choose a reason for hiding this comment

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

This works great! Since the instructions pointed you toward the MDN String documentation, take a peek at the .replaceAll() method. How could you use that to achieve the same result without needing to convert the string into an array first?


function makeUpperCaseSnakeCase(str){
const result = str.split(" ").join("_").toUpperCase(); //take str, and turn it into an array and then turn it back into a string with underscores then upper case it.
console.log("result",result);
Copy link

Choose a reason for hiding this comment

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

Make sure to clean up your debugging logs before your final submission!

Copy link

Choose a reason for hiding this comment

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

Can you please read the instruction in the assessment? You need to follow the instructions and make use of the starter code stated.

@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. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants