London | 26-ITP-May | Khaliun Baatarkhuu | Sprint 3 | Dead code - #1537
London | 26-ITP-May | Khaliun Baatarkhuu | Sprint 3 | Dead code#1537khaliun-dev wants to merge 5 commits into
Conversation
Removed redundant greeting string construction and unreachable console log.
Removed unused variables and functions to clean up the code.
tiakavousi
left a comment
There was a problem hiding this comment.
Nice work identifying the redundant and unreachable code.
One suggestion I'd make is to apply the changes directly to the original code rather than keeping both the original and the updated versions, and to remove the explanatory comments once you've finished in both excercises.
In a real codebase, reviewers should be able to quickly spot the actual changes in a pull request. Keeping dead code or temporary explanations can make the diff harder to read. Think of these exercises as if you're working on production code: clean up the redundant code, refactor where needed, and leave the file in a clean, maintainable state.
Removed unreachable code and redundant variable.
Removed unused variables and functions to clean up the code.
|
hi @tiakavousi , thank you for reviewing my PR. I have removed all the unnecessary fluff and made it a clean as possible. Cheers. |
| // Find the instances of unreachable and redundant code - remove them! | ||
| // The sayHello function should continue to work for any reasonable input it's given. | ||
|
|
||
| let testName = "Jerry"; |
There was a problem hiding this comment.
This looks much cleaner now !
one small suggestion: I think this is a dead assignment, because it's overwritten before being used.
There was a problem hiding this comment.
oops , you are right. I have changed it to const to make the code cleaner.
Changed variable testName from 'Jerry' to 'Khaliun' and updated its declaration to const.
| // The sayHello function should continue to work for any reasonable input it's given. | ||
|
|
||
| let testName = "Jerry"; | ||
| const testName = "Khaliun"; |
There was a problem hiding this comment.
You could keep let testName = "Khaliun" instead of changing it to const if it might be reassigned later.
From a dead code perspective, code has been cleaned up nicely.
Self checklist
Changelist
I have learnt to see what parts of code are considered unreachable and redundant. Also, saw a glimpse of what "filter → transform → aggregate" pattern looks like, with the second exercise.
Questions
None.