From 36cdf6c1e5ebbd215fbcb8c8e26c690b690054a5 Mon Sep 17 00:00:00 2001 From: Laura C Date: Mon, 23 Feb 2026 23:12:37 +0000 Subject: [PATCH 1/2] Remove unreachable and redundant code from sayHello --- Sprint-3/3-dead-code/exercise-1.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/Sprint-3/3-dead-code/exercise-1.js b/Sprint-3/3-dead-code/exercise-1.js index 4d09f15fa..5de7eb4ba 100644 --- a/Sprint-3/3-dead-code/exercise-1.js +++ b/Sprint-3/3-dead-code/exercise-1.js @@ -5,9 +5,7 @@ let testName = "Jerry"; const greeting = "hello"; function sayHello(greeting, name) { - const greetingStr = greeting + ", " + name + "!"; return `${greeting}, ${name}!`; - console.log(greetingStr); } testName = "Aman"; From 56ff1b9d16fd4044bb8a15efda479f9e754f0ab3 Mon Sep 17 00:00:00 2001 From: Laura C Date: Mon, 23 Feb 2026 23:16:26 +0000 Subject: [PATCH 2/2] Remove unused variables and functions from exercise 2 --- Sprint-3/3-dead-code/exercise-2.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Sprint-3/3-dead-code/exercise-2.js b/Sprint-3/3-dead-code/exercise-2.js index 56d7887c4..45f415f48 100644 --- a/Sprint-3/3-dead-code/exercise-2.js +++ b/Sprint-3/3-dead-code/exercise-2.js @@ -2,12 +2,8 @@ // The countAndCapitalisePets function should continue to work for any reasonable input it's given, and you shouldn't modify the pets variable. const pets = ["parrot", "hamster", "horse", "dog", "hamster", "cat", "hamster"]; -const capitalisedPets = pets.map((pet) => pet.toUpperCase()); -const petsStartingWithH = pets.filter((pet) => pet[0] === "h"); -function logPets(petsArr) { - petsArr.forEach((pet) => console.log(pet)); -} +const petsStartingWithH = pets.filter((pet) => pet[0] === "h"); function countAndCapitalisePets(petsArr) { const petCount = {}; @@ -20,9 +16,10 @@ function countAndCapitalisePets(petsArr) { petCount[capitalisedPet] = 1; } }); + return petCount; } const countedPetsStartingWithH = countAndCapitalisePets(petsStartingWithH); -console.log(countedPetsStartingWithH); // { 'HAMSTER': 3, 'HORSE': 1 } <- Final console log +console.log(countedPetsStartingWithH); // { 'HAMSTER': 3, 'HORSE': 1 }