BARCELONA | CLASS-OCT2025-02 | JOSEPH AYITEY | SPRINT 2 | COURSEWORK/SPRINT2 - #3
BARCELONA | CLASS-OCT2025-02 | JOSEPH AYITEY | SPRINT 2 | COURSEWORK/SPRINT2#3joseph-ayitey wants to merge 16 commits into
Conversation
…with predictions and explanation
with different test
| function capitalize(str) { | ||
| let capitalizedStr = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| return capitalizedStr; | ||
| } |
There was a problem hiding this comment.
This funcion already had been declared above
| function capitalize(str) { | ||
| console.log(capitalize("hello")); // Output: "Hello" | ||
| let str = `${str[0].toUpperCase()}${str.slice(1)}`; | ||
| return str; | ||
| } |
There was a problem hiding this comment.
This funcion already had been declared above
And this declaration does not work 🚫
| return str; | ||
| } | ||
|
|
||
| //You can reassign function parameters, but you cannot redeclare them with let or const in the same scope. |
There was a problem hiding this comment.
- What do you mean by "reassign"?
- And about "declare"?
- What do you understand for "scope"?
| // SyntaxError: Unexpected number | ||
|
|
||
| // =============> explain this error message here | ||
| // The error occurs because function parameters should be variable names, not literal values. |
There was a problem hiding this comment.
What's your understanding of "variable" vs "literal values"?
|
|
||
| // =============> write your explanation here | ||
| // The `return` statement is followed by a semicolon on the next line, | ||
| // so JavaScript automatically inserts a semicolon after `return`. |
There was a problem hiding this comment.
Little observation here, javascript does not add a semicolon after return, you IDE (visual studio, copilot, etc) does this because it has been configured to do so because it makes some kinds of easy-to-miss errors to go away
Such configuration can be turned off, as not everyone if fan of having semicolumns as mandatory
| // Explain why getLastDigit is not working properly - correct the problem | ||
|
|
||
| // The function did not accept any parameters, so it always used the constant `num` (103). | ||
| // By adding a parameter to the function, it can now accept different numbers |
There was a problem hiding this comment.
I notice the name of the parameter in the funcion is the same as the contant, what makes it work?
| `current output: ${currentOutput2}, target output: ${targetOutput2}` | ||
| ); | ||
|
|
||
| const currentOutput3 = formatAs12HourClock("12:00"); |
There was a problem hiding this comment.
Thoughout this exercise, what made you choosee this inputs to test? From this line to the EOF (end of file)?
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
Questions
Ask any questions you have for your reviewer.