Repository navigation
Conversation
| console.log(greetingStr); | ||
| } | ||
|
|
||
| testName = "Aman"; |
There was a problem hiding this comment.
Is this override necessary ? Could there be a better way to initialise this variable
There was a problem hiding this comment.
Not necessary.
We can remove the redundant assignment and pass "Aman" directly to sayHello(), keeping the function flexible for any reasonable input.
| @@ -5,9 +5,7 @@ let testName = "Jerry"; | |||
| const greeting = "hello"; | |||
There was a problem hiding this comment.
does this variable name clash with another ?
There was a problem hiding this comment.
No, it doesn't clash with another. The function parameter greeting is in a different scope. However, we can remove the outer variable and pass "hello" directly to sayHello().
amyyalex
left a comment
There was a problem hiding this comment.
Hi Abakar, great work on this! You’ve removed the unused variables, the unreachable console.log after the return, and the unused logPets function and you followed through on both points from the earlier review by passing the values straight into sayHello(). The code is much cleaner and easier to read now. Nothing more to change from me.
I don’t have label access yet, so could a mentor please mark this as Complete? Thanks!
Self checklist
Task code
CYF-1066
Changelist
Refactored by removing unused, unreachable, and redundant code.