Skip to content
6 changes: 3 additions & 3 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,13 +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 = "Jerry";
const greeting = "hello";

function sayHello(greeting, name) {
const greetingStr = greeting + ", " + name + "!";
//const greetingStr = greeting + ", " + name + "!";
return `${greeting}, ${name}!`;
console.log(greetingStr);
// console.log(greetingStr);
}

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.

This will either result in a variable in the global scope or throw an error. Can you find a way to change it?

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, exercise 1 updated with the test moved to a function. Thanks Damian

Expand Down
8 changes: 4 additions & 4 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,12 +2,12 @@
// 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 capitalisedPets = pets.map((pet) => pet.toUpperCase());
const petsStartingWithH = pets.filter((pet) => pet[0] === "h");

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

function countAndCapitalisePets(petsArr) {
const petCount = {};
Expand Down
Loading