Skip to content

Commit 653b555

Browse files
Sprint 3 - Dead Code: Remove unused code in exercise-2
1 parent efa6142 commit 653b555

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
// 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.
2+
//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");
76

8-
function logPets(petsArr) {
9-
petsArr.forEach((pet) => console.log(pet));
10-
}
11-
127
function countAndCapitalisePets(petsArr) {
138
const petCount = {};
149

@@ -23,6 +18,4 @@ function countAndCapitalisePets(petsArr) {
2318
return petCount;
2419
}
2520

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

Sprint-3/3-dead-code/newFile.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"name": "module-structuring-and-testing-data",
3+
"type": "module",
34
"version": "1.0.0",
45
"description": "Like learning a musical instrument, programming requires daily practice.",
56
"main": "index.js",

0 commit comments

Comments
 (0)