-
-
Notifications
You must be signed in to change notification settings - Fork 244
West Midlands | ITP-Sept-25 | Mustaf Asani | Sprint 2 | coursework/sprint-2 #777
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
base: main
Are you sure you want to change the base?
Conversation
| } | ||
| // return the BMI of someone based off their weight and height | ||
| const bmi = weight / height ** 2; | ||
| return bmi.toFixed(1); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the function will return a string representation of the equivalent number with the specified number of decimal places. I had expected it to produce a number but because i used the toFixed() method to shorten the answer to the required number of decimal places this changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a function does not perform as expected, shouldn't we change the function to meet our expectation (instead of the other around)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
converted bmi to number.
|
|
||
| if (hours > 12) { | ||
| return `${hours - 12}:00 pm`; | ||
| return `${hours - 12}:${minutes} pm`; | ||
| } | ||
| return `${time} am`; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you expect from the following function calls?
formatAs12HourClock("00:00");
formatAs12HourClock("01:01");
formatAs12HourClock("13:01"); Does your function return the value you expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the 00:00 input did not give the expected value. I added a condition to handle the hours between midnight and 01 am so all 00 hours.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about making the format of the returned string values from these two function calls more consistent?
formatAs12HourClock("01:01");
formatAs12HourClock("13:01");
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you i had missed that, made the format for both times match, romved the trailing zero.
|
Changes look good! |
Learners, PR Template
Self checklist
Changelist
finished all the tasks for coursework sprint 2