Repository navigation
Cape Town | 26-ITP- Sept | Leigh Ross | Sprint 3 | Refactoring Dead Code #1719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
05cbf49
44c2ce3
a7912d7
28dd010
e75ac48
77d2d37
f64f9fe
9053cec
30864f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. to uppercase is found both inside and outside the function, that's redudancy
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again I am not sure what you are referring to because I have deleted the redundant code. Please recheck my work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Apollogies, on the to uppercase I might have made a mistake, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "I had removed the testName variable in favor of passing the name as a variable ." it is not a variable in your code, it has to be a variale, while you mantaining your goal of removing redudancy
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay I see. I have made the necessary changes. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,10 @@ | ||
| // 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"; | ||
| const greeting = "hello"; | ||
|
|
||
| function sayHello(greeting, name) { | ||
| const greetingStr = greeting + ", " + name + "!"; | ||
| return `${greeting}, ${name}!`; | ||
| console.log(greetingStr); | ||
| } | ||
|
|
||
| testName = "Aman"; | ||
|
|
||
| const greetingMessage = sayHello(greeting, testName); | ||
| let testName = "Aman" | ||
|
|
||
| console.log(greetingMessage); // 'hello, Aman!' | ||
| console.log(sayHello("hello", testName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for it to work on every name, you don't need to hard code Aman!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi there, not sure what you are referring to.
I had removed the testName variable in favor of passing the name as a variable .
Please check my work again.