Cape Town | 26-ITP-May | Shafiek Walker | Sprint 2 | Coursework Exercises#1388
Open
shafiekwalker7861 wants to merge 8 commits into
Open
Cape Town | 26-ITP-May | Shafiek Walker | Sprint 2 | Coursework Exercises#1388shafiekwalker7861 wants to merge 8 commits into
shafiekwalker7861 wants to merge 8 commits into
Conversation
cjyuan
reviewed
Jun 27, 2026
|
|
||
| function calculateBMI(weight, height) { | ||
| // return the BMI of someone based off their weight and height | ||
| return (weight / (height * height)).toFixed(1); |
Contributor
There was a problem hiding this comment.
What type of value do you expect your function to return? A number or a string?
Does your function return the type of value you expect?
Author
There was a problem hiding this comment.
Thanks for the feedback! I updated the function so it now returns a number instead of a string by using Number(...) around the toFixed() result.
Comment on lines
+38
to
+43
| const currentOutput3 = formatAs12HourClock("12:00"); | ||
| const targetOutput3 = "12:00 pm"; | ||
| console.assert( | ||
| currentOutput3 === targetOutput3, | ||
| `current output: ${currentOutput3}, target output: ${targetOutput3}` | ||
| ); |
Contributor
There was a problem hiding this comment.
What do you expect from the following function calls?
formatAs12HourClock("00:34");
formatAs12HourClock("12:34");
formatAs12HourClock("01:01");
formatAs12HourClock("13:01");
- Does your function return the value you expected?
- Are the return values consistently formatted?
Author
There was a problem hiding this comment.
Thanks! I added tests for these edge cases, updated the function to preserve the minutes, and made the formatting consistent for all the cases you mentioned.
Contributor
|
Changes look good. |
Author
|
Thanks @cjyuan , Much apprciated. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Changelist
Completed all Sprint 2 mandatory exercises, including debugging, implementing functions, interpreting code, and stretch exercises. All code was tested before submission.