London | 26-ITP-May | Martin Mwaka | Sprint 2 | Coursework Exercises#1363
London | 26-ITP-May | Martin Mwaka | Sprint 2 | Coursework Exercises#1363Temceo wants to merge 12 commits into
Conversation
LonMcGregor
left a comment
There was a problem hiding this comment.
Good work, I just have one question about one of the tasks
| // return the BMI of someone based off their weight and height | ||
| } No newline at end of file | ||
| // return the BMI of someone based off their weight and height | ||
| const heightSquared = Number((height * height).toFixed(2)); |
There was a problem hiding this comment.
Do you need to do the fixed and number conversion on this line 19?
There was a problem hiding this comment.
Converting to number has no effect as toFixed ensures text is returned. I have update this line as follows: return (weight / heightSquared).toFixed(1);
There was a problem hiding this comment.
I was more asking about why you do tofixed(2) on the first line, then do another tofixed(1) on the final line. toFixed is used for changing the presentation of the final output, so why are you using it as an earlier part of the calculation?
There was a problem hiding this comment.
I understand. I have refactored this to a single line now
Self checklist
Changelist
JavaScript mandatory coursework exercises for sprint 2