Skip to content

Commit ede74a2

Browse files
committed
Remove dead code exercises from Sprint 3 PR
1 parent d8cdf7a commit ede74a2

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ let testName = "Jerry";
55
const greeting = "hello";
66

77
function sayHello(greeting, name) {
8+
const greetingStr = greeting + ", " + name + "!";
89
return `${greeting}, ${name}!`;
10+
console.log(greetingStr);
911
}
1012

1113
testName = "Aman";

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,27 @@
22
// The countAndCapitalisePets function should continue to work for any reasonable input it's given, and you shouldn't modify the pets variable.
33

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

8+
function logPets(petsArr) {
9+
petsArr.forEach((pet) => console.log(pet));
10+
}
11+
812
function countAndCapitalisePets(petsArr) {
913
const petCount = {};
1014

1115
petsArr.forEach((pet) => {
1216
const capitalisedPet = pet.toUpperCase();
13-
1417
if (petCount[capitalisedPet]) {
1518
petCount[capitalisedPet] += 1;
1619
} else {
1720
petCount[capitalisedPet] = 1;
1821
}
1922
});
20-
2123
return petCount;
2224
}
2325

2426
const countedPetsStartingWithH = countAndCapitalisePets(petsStartingWithH);
2527

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

0 commit comments

Comments
 (0)