Skip to content

Commit a969de2

Browse files
committed
fix mistakes in countAndCapitalisePets exercise
1 parent ef36391 commit a969de2

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
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());
5+
// const capitalisedPets = pets.map((pet) => pet.toUpperCase()); -> this line is not necessary because the same functionality is implemented inside the function countAndCapitalisePets.
6+
// Also, the variable capitalisedPets in not being used in the global scope
67
const petsStartingWithH = pets.filter((pet) => pet[0] === "h");
78

8-
function logPets(petsArr) {
9-
petsArr.forEach((pet) => console.log(pet));
10-
}
9+
// function logPets(petsArr) {
10+
// petsArr.forEach((pet) => console.log(pet));
11+
// } -> This function is not being used/called anywhere in the program, it is redundant code and should be removed.
1112

1213
function countAndCapitalisePets(petsArr) {
1314
const petCount = {};

0 commit comments

Comments
 (0)