Repository navigation
London | 26-ITP-Sep | Mars Adesina | Sprint 3 | Refactoring Dead Code #1745
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
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,8 @@ | ||
| // 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); | ||
|
|
||
| console.log(greetingMessage); // 'hello, Aman!' | ||
| console.log(sayHello("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. Excellent work start on structuring the function and array operations. Quick question: countedPetsStartingWithH is declared twice, and the function currently returns an empty object. How might you iterate through the array to populate the frequency map?
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. Hi , Thanks for reviewing my work. I'm a little unsure about your feedback regarding the duplicate declaration and the empty object. I moved the countedPetsStartingWithH declaration rather than keeping both declarations, and my function already had the .forEach() loop to populate petCount. When I run my current code, it returns { HAMSTER: 3, HORSE: 1 }. Could you clarify what I need to change or which part I may have misunderstood? Thanks! |
Uh oh!
There was an error while loading. Please reload this page.