Conversation
✅ Deploy Preview for cyf-onboarding-module ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
|
||
| //tests | ||
| let [pounds, pence] = toPounds("399p"); | ||
| console.log(`£${pounds}.${pence}`); |
There was a problem hiding this comment.
Can you think of a way to avoid repeating £${pounds}.${pence} after every call?"
| const hours = Number(time.slice(0, 2)); | ||
| if (hours > 12) { | ||
| return `${hours - 12}:00 pm`; | ||
| return `${hours - 12 < 10 ? "0" : ""}${hours - 12}:${time.slice(-2)} pm`; |
There was a problem hiding this comment.
Can you think of any other edge cases that could surface here?
|
|
||
| function calculateBMI(weight, height) { | ||
| // return the BMI of someone based off their weight and height | ||
| return Number.parseFloat(weight / (height * height)).toFixed(1); |
There was a problem hiding this comment.
Could be worth having another look at the Number.parseFloat docs. What type of value does it expect, and what are we passing it here?
| console.log(calculateBMI(80, 1.69)); | ||
| console.log(calculateBMI(51, 1.55)); | ||
|
|
||
| // Please could I have a little feedback about if I have refactored the function return too much? |
There was a problem hiding this comment.
One line is totally fine here! As a rule of thumb, you can keep it in one line as long as it is easy to understand.
| // This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase | ||
|
|
||
| function toUpperSnakeCase(str) { | ||
| return str.toUpperCase().split(" ").join("_"); |
There was a problem hiding this comment.
Nice! Very clean solution and great function name.
|
Great job! Very solid and clean solutions. And kudos on doing the extend exercise! |

Learners, PR Template
Self checklist
Task code
CYF-1053
Changelist
I solved the coursework in folder "Sprint-3". I also committed the "prep" folder, which you can ignore as it doesn't need grading.