Birmingham | ITP-May-2025 | Peter Lui | S&TD Sprint 2#549
Birmingham | ITP-May-2025 | Peter Lui | S&TD Sprint 2#549petergmlui wants to merge 5 commits intoCodeYourFuture:mainfrom
Conversation
LonMcGregor
left a comment
There was a problem hiding this comment.
Good answers. There's one small part where you might want to take another look. Other than that, good work.
|
|
||
| // round to 1 decimal place | ||
| bmi = (Math.round((bmi*10)))/10; | ||
|
|
There was a problem hiding this comment.
There might be a cleaner way to get 1 decimal place. Multiplying by 10 and then dividing by 10 a bit complicated.
There was a problem hiding this comment.
@LonMcGregor Thank you for your review! While I understand what you mean, using toFixed(1) is easier, but toFixed() returns a string, and round() returns a number. The instructions were not that clear about returning a string or a number, can you please clarify?
There was a problem hiding this comment.
Hi @petergmlui - I think the reviewers suggesting is based on style preference and possibly just alerting you to other ways to do this. :)
You can console out a number or a string. It depends on what you want your function to return.
Since .toFixed() returns a valid number as a string, you could convert the string value to a number, if you want.
There was a problem hiding this comment.
@jenny-alexander Hi, thanks for your advice too, I have updated to use toFixed() and output a string at the same time I asked for clarification. If I am not mistaken about your advice, can you please mark this PR as complete?
Used toFixed(1) to modify to one decimal per volunteer request (but it will now return a string instead of a number)
|
|
||
| // round to 1 decimal place | ||
| bmi = (Math.round((bmi*10)))/10; | ||
|
|
There was a problem hiding this comment.
@LonMcGregor Thank you for your review! While I understand what you mean, using toFixed(1) is easier, but toFixed() returns a string, and round() returns a number. The instructions were not that clear about returning a string or a number, can you please clarify?
return bmi in number type
|
@oluwatunmiisheii Wilson thank you for your help in class today! I have updated to return bmi in number type by using +. Have a great weekend! |
Self checklist
Changelist
Initial submission
Questions
Ask any questions you have for your reviewer.