Cape Town |ITP-MAY-26|Enice Mutanda|Sprint 2| Coursework #1400
Cape Town |ITP-MAY-26|Enice Mutanda|Sprint 2| Coursework #1400Enice-Codes wants to merge 7 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
5 similar comments
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.
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.
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.
1 similar comment
This comment has been minimized.
This comment has been minimized.
| // Use the MDN string documentation to help you find a solution | ||
| // This might help https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/toUpperCase | ||
|
|
||
| function touppersneakers (input){ |
There was a problem hiding this comment.
Could you look up the naming conventions in JavaScript? In particular,
- Variable and function names
- Class and Types names
- Named constants
Then, update the function name according to those conventions.
| if (hours > 12) { | ||
| return `${hours - 12}:00 pm`; | ||
| return `${hours - 12}:${minutes} pm`; | ||
| } | ||
|
|
||
| return `${time} am`; |
There was a problem hiding this comment.
The code looks correct.
Could you update the code so that the return values of formatAs12HourClock("01:23") and formatAs12HourClock("13:23") are formatted consistently?
| // Finally, correct the code to fix the problem | ||
| // =============> write your new code here | ||
| function multiply (a,b){ | ||
| if (a===10 && b===32){ |
There was a problem hiding this comment.
Why check if the parameters a and b are these particular values?
|
|
||
| function touppersneakers (input){ | ||
| return input.toUpperCase(); | ||
| } |
There was a problem hiding this comment.
-
This function have not yet met all the requirements (the return value is not yet in
UPPER_SNAKE_CASE). -
Also, have you found out the naming convention for function names in JS?
| const currentOutput = formatAs12HourClock("08:00"); | ||
| const targetOutput = "08:00 am"; | ||
| // Existing tests | ||
| console.assert( | ||
| formatAs12HourClock("8:00") === "8:00 am", | ||
| "8:00 should be 8:00 am" | ||
| ); |
There was a problem hiding this comment.
The original tests suggest the argument is a string in the form "hh:mm" (2-digit hour and 2-digit minute).
Without changing the argument, to make the return value formatted consistently we could conditionally pad a 0 to the hour so that the return value is in the form "hh:mm am" or "hh:mm pm".
Self Check
Changelist
Answered questions to all excerises
completed code
checked code on node
Used Dev tools as per an excercise