-
-
Notifications
You must be signed in to change notification settings - Fork 238
Birmingham | 25-ITP-Sep | Joy Opachavalit | Sprint 2 | coursework/sprint-2 #774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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