Birmingham | 26-ITP-May | Gabriel Pawuoi| Sprint 2 | Coursework #1467
Birmingham | 26-ITP-May | Gabriel Pawuoi| Sprint 2 | Coursework #1467KhotKeys wants to merge 1 commit into
Conversation
This comment has been minimized.
This comment has been minimized.
| // b) num = 0 (totalHours) when pad is called for the first time. | ||
|
|
||
| // Call formatTimeDisplay with an input of 61, now answer the following: | ||
| // c) pad(0): "0".length < 2, so prepend "0" -> "00". Return value: "00" | ||
|
|
||
| // b) What is the value assigned to num when pad is called for the first time? | ||
| // =============> write your answer here | ||
| // d) num = 1 (remainingSeconds) when pad is called for the last time. | ||
| // It is the last argument passed in the template literal. | ||
|
|
||
| // c) What is the return value of pad is called for the first time? | ||
| // =============> write your answer here | ||
|
|
||
| // d) What is the value assigned to num when pad is called for the last time in this program? Explain your answer | ||
| // =============> write your answer here | ||
|
|
||
| // e) What is the return value of pad when it is called for the last time in this program? Explain your answer | ||
| // =============> write your answer here | ||
| // e) pad(1): "1".length < 2, so prepend "0" -> "01". Return value: "01" |
There was a problem hiding this comment.
These answers are good, but it could be a little confusing to gauge the answers mean without the context of the questions since you deleted them. This is somewhat true of the other questions as well, it's not the end of the world but bear in mind that if you were to ever look back on this repo, you'd have to look at the commits to see the diffs (i.e. what we can see right now in GitHub) in order to understand the work.
There was a problem hiding this comment.
Note: you don't need to do anything in response to this comment, but I just wanted to highlight it for your own reference in case you should want to do anything.
|
|
||
| function capitalise(str) { | ||
| let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| str = `${str[0].toUpperCase()}${str.slice(1)}`; |
There was a problem hiding this comment.
Generally we reassign the value of a variable if we want to update the value whilst the recognising that what the value represents has stayed the same. Here, you're reassigning str to be something that represents a different thing. Considering this, can you think of an alternative approach to reassigning the existing str variable that would make this a little bit more readable?
Learners, PR Template
Self checklist
Changelist
completed all mandatory and stretch