Skip to content

WESTMIDLANDS| ITP-MAY 2025| ROJA ALAGURAJAN| Module Structuring and Testing Data|sprint 2 #612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

alagurajan-roja
Copy link

@alagurajan-roja alagurajan-roja commented Jun 26, 2025

Learners, PR Template

Self checklist

  • I have committed my files one by one, on purpose, and for a reason
  • I have titled my PR with REGION | COHORT_NAME | FIRST_NAME LAST_NAME | PROJ_NAME
  • I have tested my changes
  • My changes follow the style guide
  • My changes meet the requirements of this task

Changelist

Briefly explain your PR.
Completed all mandatory coursework, including:
1.Exercises
2.Error handling tasks
3.Code interpretation and explanation
Briefly explain your PR.

Questions

Ask any questions you have for your reviewer.

@alagurajan-roja alagurajan-roja added the Needs Review Participant to add when requesting review label Jun 26, 2025
@alagurajan-roja alagurajan-roja changed the title WESTMIDLANDS| ITP-MAY 2025| ROJA ALAGURAJAN| coursework/sprint 2 WESTMIDLANDS| ITP-MAY 2025| ROJA ALAGURAJAN| Module Structuring and Testing Datasprint 2 Jun 26, 2025
@alagurajan-roja alagurajan-roja changed the title WESTMIDLANDS| ITP-MAY 2025| ROJA ALAGURAJAN| Module Structuring and Testing Datasprint 2 WESTMIDLANDS| ITP-MAY 2025| ROJA ALAGURAJAN| Module Structuring and Testing Data|sprint 2 Jun 26, 2025
const bmi = weightKg / square;
// return the BMI to 1 decimal
return bmi.toFixed(1);
Copy link
Contributor

Choose a reason for hiding this comment

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

What type of value do you expect the function to return? A number or a string?
Does your function return the type of value you expect it to return?

Copy link
Author

Choose a reason for hiding this comment

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

Hi @cjyuan,
I expect the function to return a number, since BMI is a numeric value used for further analysis, such as comparing it to health category thresholds (e.g., underweight, normal, overweight).

However, in the current version of the function, it returns a string, because the .toFixed(1) method formats the number to 1 decimal place but returns it as a string.

square=(heightM*heightM);
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is square being declared?

Copy link
Author

Choose a reason for hiding this comment

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

Hi @cjyuan
In the corrected version of the code, square is declared inside the calculateBMI function using the const keyword:

const square = heightM * heightM;

function formatAs12HourClock(time) {
const [hourStr, minuteStr] = time.split(":");
let hours = Number(hourStr);
const minutes = minuteStr;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just use minuteStr instead of introducing another variable?

Copy link
Author

@alagurajan-roja alagurajan-roja Jul 6, 2025

Choose a reason for hiding this comment

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

Hi @cjyuan ,

I have updated and corrected the code based on your feedback. Please take a look and let me know if you have any further suggestions or improvements.

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review and removed Needs Review Participant to add when requesting review labels Jul 6, 2025
@alagurajan-roja alagurajan-roja added Needs Review Participant to add when requesting review and removed Reviewed Volunteer to add when completing a review labels Jul 6, 2025
@cjyuan
Copy link
Contributor

cjyuan commented Jul 6, 2025

Changes look good! Well done.

@cjyuan cjyuan added Complete Volunteer to add when work is complete and review comments have been addressed and removed Needs Review Participant to add when requesting review labels Jul 6, 2025
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 review comments have been addressed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants