Repository navigation
London | 26-Sep-ITP | Frumentius Tesfay | Sprint 3 | Coursework/sprint 3 dead code #1772
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
bf34f10
d438afa
2114d70
e5baf35
6366b00
89c6ae8
7da20a1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,13 @@ | ||
| // 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"; | ||
| let testName = "Aman"; | ||
| const greeting = "hello"; | ||
|
|
||
| function sayHello(greeting, name) { | ||
| const greetingStr = greeting + ", " + name + "!"; | ||
| return `${greeting}, ${name}!`; | ||
| console.log(greetingStr); | ||
| } | ||
|
|
||
| testName = "Aman"; | ||
|
|
||
| const greetingMessage = sayHello(greeting, testName); | ||
|
|
||
| console.log(greetingMessage); // 'hello, Aman!' |
|
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 help refine it: Being far from home is tough, but your persistence and focus are building a brilliant path forward—keep pushing! |
|
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. Thank you so much for sharing your code—it's wonderful to see the loop and counter logic set up so cleanly! If we look closely at the very beginning of the function, what do you think happens when execution encounters |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,10 @@ | ||
| export function countChar(stringOfCharacters, findCharacter) { | ||
| return 5 | ||
| let count = 0; | ||
|
|
||
| for (const character of stringOfCharacters) { | ||
| if (character === findCharacter) { | ||
| count++; | ||
| } | ||
| } | ||
| return count; | ||
| } |
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.
Being far from home is tough, but every line of code you write is a step closer to building the future you deserve—keep going!
letto declaretestNametwice in the same scope?sayHello, what happens to any code placed after thereturnstatement, and isgreetingStrused anywhere else in that function?