Skip to content

Commit 4afd79c

Browse files
committed
removed dead code from the countCapitalisePets function
1 parent ce316cc commit 4afd79c

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

‎dead-code/exercise-2.js‎

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

128
function countAndCapitalisePets(petsArr) {
139
const petCount = {};
@@ -23,6 +19,4 @@ function countAndCapitalisePets(petsArr) {
2319
return petCount;
2420
}
2521

26-
const countedPetsStartingWithH = countAndCapitalisePets(petsStartingWithH);
27-
2822
console.log(countedPetsStartingWithH); // { 'HAMSTER': 3, 'HORSE': 1 } <- Final console log

0 commit comments

Comments
 (0)