Skip to content

Commit ff7b05d

Browse files
committed
Step 3 - Dead code task has been completed.
1 parent b31a586 commit ff7b05d

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

Sprint-3/3-dead-code/exercise-1.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
// Find the instances of unreachable and redundant code - remove them!
22
// The sayHello function should continue to work for any reasonable input it's given.
3+
// didn't delete the above two because its the question you may need to refer.
34

4-
let testName = "Jerry";
55
const greeting = "hello";
66

77
function sayHello(greeting, name) {
8-
const greetingStr = greeting + ", " + name + "!";
8+
99
return `${greeting}, ${name}!`;
1010
console.log(greetingStr);
1111
}
@@ -14,4 +14,4 @@ testName = "Aman";
1414

1515
const greetingMessage = sayHello(greeting, testName);
1616

17-
console.log(greetingMessage); // 'hello, Aman!'
17+
console.log(greetingMessage);

Sprint-3/3-dead-code/exercise-2.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
// Remove the unused code that does not contribute to the final console log
22
// The countAndCapitalisePets function should continue to work for any reasonable input it's given, and you shouldn't modify the pets variable.
3-
3+
// didn't delete the above two because its the question you may need to refer.
44
const pets = ["parrot", "hamster", "horse", "dog", "hamster", "cat", "hamster"];
5-
const capitalisedPets = pets.map((pet) => pet.toUpperCase());
6-
const petsStartingWithH = pets.filter((pet) => pet[0] === "h");
75

8-
function logPets(petsArr) {
9-
petsArr.forEach((pet) => console.log(pet));
10-
}
6+
const petsStartingWithH = pets.filter((pet) => pet[0] === "h");
117

128
function countAndCapitalisePets(petsArr) {
139
const petCount = {};
@@ -25,4 +21,4 @@ function countAndCapitalisePets(petsArr) {
2521

2622
const countedPetsStartingWithH = countAndCapitalisePets(petsStartingWithH);
2723

28-
console.log(countedPetsStartingWithH); // { 'HAMSTER': 3, 'HORSE': 1 } <- Final console log
24+
console.log(countedPetsStartingWithH);

0 commit comments

Comments
 (0)