From 359134ddd335b489dab58d2723926a9c1908046d Mon Sep 17 00:00:00 2001 From: Mahir Shah Date: Wed, 14 Oct 2026 14:04:59 +0100 Subject: [PATCH 1/2] Remove dead and redundant code --- dead-code/exercise-1.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/dead-code/exercise-1.js b/dead-code/exercise-1.js index 4d09f15fa9..3d1d6f94d0 100644 --- a/dead-code/exercise-1.js +++ b/dead-code/exercise-1.js @@ -1,17 +1,13 @@ // 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"; +let testName = Aman; const greeting = "hello"; function sayHello(greeting, name) { - const greetingStr = greeting + ", " + name + "!"; return `${greeting}, ${name}!`; - console.log(greetingStr); } -testName = "Aman"; - const greetingMessage = sayHello(greeting, testName); console.log(greetingMessage); // 'hello, Aman!' From 8c2b28ed3e4c2a6abad79b4e764816823e0b5577 Mon Sep 17 00:00:00 2001 From: Mahir Shah Date: Wed, 14 Oct 2026 14:34:57 +0100 Subject: [PATCH 2/2] Remove unused code --- dead-code/exercise-2.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/dead-code/exercise-2.js b/dead-code/exercise-2.js index 56d7887c4c..b1c2362d34 100644 --- a/dead-code/exercise-2.js +++ b/dead-code/exercise-2.js @@ -2,13 +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)); -} - function countAndCapitalisePets(petsArr) { const petCount = {};