From 0d96d12b3ef013a7d9732bea3780eba2013f8fb7 Mon Sep 17 00:00:00 2001 From: d-odumosu Date: Mon, 20 Jul 2026 20:19:48 +0100 Subject: [PATCH 1/2] removed dead and redundant lines of code --- Sprint-3/3-dead-code/exercise-1.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Sprint-3/3-dead-code/exercise-1.js b/Sprint-3/3-dead-code/exercise-1.js index 4d09f15fa9..ec964da74e 100644 --- a/Sprint-3/3-dead-code/exercise-1.js +++ b/Sprint-3/3-dead-code/exercise-1.js @@ -1,17 +1,12 @@ // Find the instances of unreachable and redundant code - remove them! // The sayHello function should continue to work for any reasonable input it's given. -let testName = "Jerry"; -const greeting = "hello"; + function sayHello(greeting, name) { - const greetingStr = greeting + ", " + name + "!"; return `${greeting}, ${name}!`; - console.log(greetingStr); } -testName = "Aman"; - -const greetingMessage = sayHello(greeting, testName); +const greetingMessage = sayHello("hello", "Aman"); console.log(greetingMessage); // 'hello, Aman!' From 2bc34740a10b18b8663f84a9a5874b2de488f31e Mon Sep 17 00:00:00 2001 From: d-odumosu Date: Mon, 20 Jul 2026 21:08:51 +0100 Subject: [PATCH 2/2] removed dead and redundant lines of code --- Sprint-3/3-dead-code/exercise-2.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Sprint-3/3-dead-code/exercise-2.js b/Sprint-3/3-dead-code/exercise-2.js index 56d7887c4c..828deb3e13 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"); + const petsStartingWithH = pets.filter((pet) => pet[0] === "h"); -function logPets(petsArr) { - petsArr.forEach((pet) => console.log(pet)); -} function countAndCapitalisePets(petsArr) { const petCount = {};