Skip to content

Cape Town | 26-ITP-Sept | Vaidah Simenti | Sprint 3 | Refactoring Dead Code - #1727

Open
Vaidah-dev wants to merge 2 commits into
CodeYourFuture:mainfrom
Vaidah-dev:coursework/sprint-3-dead-code-fixed
Open

Vaidah-dev wants to merge 2 commits into
CodeYourFuture:mainfrom
Vaidah-dev:coursework/sprint-3-dead-code-fixed

Conversation

@Vaidah-dev

Copy link
Copy Markdown

Self checklist

[X] I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
[X] My changes meet the requirements of the task
[X] I have tested my changes
[X] My changes follow the style guide

Task code
CYF-1066

Changelist
Exercise 1

Removed const greetingStr (redundant because the function built a string it never used)
Removed console.log(greetingStr) (unreachable because it is placed after return)
Removed initial testName = "Jerry" (redundant because it is overwritten before use)
Exercise 2

Removed const capitalisedPets (redundant because it is computed but never used)
Removed logPets function (unreachable because it is never called)

@Vaidah-dev Vaidah-dev added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 17, 2026
@madhuranakate madhuranakate added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 21, 2026
Comment thread dead-code/exercise-1.js Outdated
// The sayHello function should continue to work for any reasonable input it's given.

let testName = "Jerry";
const greeting = "hello";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this variable name clashing with another ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, the parameter 'greeting' was shadowing the global, i have removed the global variable completely and passed "hello" directly into the clash.

Comment thread dead-code/exercise-1.js Outdated
}

testName = "Aman";
let testName = "Aman";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its correct that you removed the previous testName but if you are not overriding testName, is let necessary ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, since i removed the reassignment, the value never changes so i guess 'const' is the correct choice.

@madhuranakate madhuranakate added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Oct 21, 2026
@Vaidah-dev Vaidah-dev added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants