Birmingham | 25-ITP-Sep | Joy Opachavalit | Sprint 2 | coursework/sprint-2#774
Birmingham | 25-ITP-Sep | Joy Opachavalit | Sprint 2 | coursework/sprint-2#774enjoy15 wants to merge 15 commits intoCodeYourFuture:mainfrom
Conversation
a-robson
left a comment
There was a problem hiding this comment.
Great job. You show a solid grasp of some Javascript fundamentals and your explanations are clear. There is just the one issue to address.
| function toPounds (penceString) { | ||
| const penceStringWithoutTrailingP = penceString.substring(0, penceString.length - 1); | ||
| const paddedPenceNumberString = penceStringWithoutTrailingP.padStart(3, "0"); | ||
| const pounds = paddedPenceNumberString.substring(0, paddedPenceNumberString.length - 2); | ||
| const pence = paddedPenceNumberString | ||
| .substring(paddedPenceNumberString.length - 2) | ||
| .padEnd(2, "0"); | ||
| return `£${pounds}.${pence}`; | ||
| } | ||
| console.log(toPounds("399p")); |
There was a problem hiding this comment.
Nice work. However you should test the function with a number of different inputs. Thinking about different cases helps us make our code more robust. Can you add some examples of typical uses of the function? You might also like to think about types of input that the function won't handle well.
There was a problem hiding this comment.
Added more examples of typical uses of the function and types of input that the function won't handle well.
There was a problem hiding this comment.
Excellent. Good work on the edge cases. I'll mark this review 'Complete'.
Learners, PR Template
Self checklist
#Changelist
-Completed all excercises in Sprint-2