Skip to content
15 changes: 7 additions & 8 deletions Sprint-3/3-dead-code/exercise-1.js
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Commenting out and removing are not the same thing; knowing that, can you tidy these files up?

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.

Hi hkavalikas, thanks for reviewing. Exercises updated with code deleted not just commented out. Thanks Damian

Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
// 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);
// Avoid polluting the global scope by keeping example data local
function demo() {
const testName = "Aman"; // local variable
const greetingMessage = sayHello(greeting, testName);
console.log(greetingMessage); // 'hello, Aman!'
}

console.log(greetingMessage); // 'hello, Aman!'
demo();
5 changes: 0 additions & 5 deletions Sprint-3/3-dead-code/exercise-2.js
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same note re; comment vs deletion

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Hi hkavalikas-Thanks for the feedback, However I don't understand it? All comments removed and only code remains in exercise 2. Please could you explain what I need to do to correct? Thanks

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Ah apologies @DamianDL , I meant it looks great with the ✅ and that the task was done. The PR already has the Complete status :)

Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,8 @@
// The countAndCapitalisePets function should continue to work for any reasonable input it's given, and you shouldn't modify the pets variable.

const pets = ["parrot", "hamster", "horse", "dog", "hamster", "cat", "hamster"];
const capitalisedPets = pets.map((pet) => pet.toUpperCase());
const petsStartingWithH = pets.filter((pet) => pet[0] === "h");

function logPets(petsArr) {
petsArr.forEach((pet) => console.log(pet));
}

function countAndCapitalisePets(petsArr) {
const petCount = {};

Expand Down