Skip to content

Commit 03c987e

Browse files
committed
Birmingham | 26-ITP-May | Gabriel Pawuoi | Sprint 3 | Dead code
1 parent 97ce7c6 commit 03c987e

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,4 @@
1-
// Remove the unused code that does not contribute to the final console log
2-
// The countAndCapitalisePets function should continue to work for any reasonable input it's given, and you shouldn't modify the pets variable.
3-
41
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-
}
112

123
function countAndCapitalisePets(petsArr) {
134
const petCount = {};
@@ -23,6 +14,7 @@ function countAndCapitalisePets(petsArr) {
2314
return petCount;
2415
}
2516

17+
const petsStartingWithH = pets.filter((pet) => pet[0] === "h");
2618
const countedPetsStartingWithH = countAndCapitalisePets(petsStartingWithH);
2719

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

0 commit comments

Comments
 (0)