Skip to content

Commit 8c21873

Browse files
committed
Removed dead code: unused capitalisedPets, petsStartingWithH, logPets function
1 parent d753e5f commit 8c21873

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

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

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
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-
const capitalisedPets = pets.map((pet) => pet.toUpperCase());
6-
const petsStartingWithH = pets.filter((pet) => pet[0] === "h");
7-
8-
function logPets(petsArr) {
9-
petsArr.forEach((pet) => console.log(pet));
10-
}
115

126
function countAndCapitalisePets(petsArr) {
137
const petCount = {};
@@ -23,6 +17,6 @@ function countAndCapitalisePets(petsArr) {
2317
return petCount;
2418
}
2519

26-
const countedPetsStartingWithH = countAndCapitalisePets(petsStartingWithH);
20+
const countedPets = countAndCapitalisePets(pets);
2721

28-
console.log(countedPetsStartingWithH); // { 'HAMSTER': 3, 'HORSE': 1 } <- Final console log
22+
console.log(countedPets); // { 'PARROT': 1, 'HAMSTER': 3, 'HORSE': 1, 'DOG': 1, 'CAT': 1 }

0 commit comments

Comments
 (0)