Skip to content

Commit 44135e3

Browse files
committed
Deleted the old code
1 parent b55668e commit 44135e3

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

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

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,3 @@
1-
/**
2-
* Original file:
3-
*
4-
// Remove the unused code that does not contribute to the final console log
5-
// The countAndCapitalisePets function should continue to work for any reasonable input it's given, and you shouldn't modify the pets variable.
6-
7-
const pets = ["parrot", "hamster", "horse", "dog", "hamster", "cat", "hamster"];
8-
const capitalisedPets = pets.map((pet) => pet.toUpperCase());
9-
const petsStartingWithH = pets.filter((pet) => pet[0] === "h");
10-
11-
function logPets(petsArr) {
12-
petsArr.forEach((pet) => console.log(pet));
13-
}
14-
15-
function countAndCapitalisePets(petsArr) {
16-
const petCount = {};
17-
18-
petsArr.forEach((pet) => {
19-
const capitalisedPet = pet.toUpperCase();
20-
if (petCount[capitalisedPet]) {
21-
petCount[capitalisedPet] += 1;
22-
} else {
23-
petCount[capitalisedPet] = 1;
24-
}
25-
});
26-
return petCount;
27-
}
28-
29-
const countedPetsStartingWithH = countAndCapitalisePets(petsStartingWithH);
30-
31-
console.log(countedPetsStartingWithH); // { 'HAMSTER': 3, 'HORSE': 1 } <- Final console log
32-
*
33-
* End of file
34-
*/
351

362
// Remove the unused code that does not contribute to the final console log
373
// The countAndCapitalisePets function should continue to work for any reasonable input it's given, and you shouldn't modify the pets variable.

0 commit comments

Comments
 (0)