From a0afb6c16e96d23387e3b1792807d2e72e0a6a8e Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Tue, 27 Oct 2026 22:42:56 +0000 Subject: [PATCH 1/7] Remove the let declaration from line 4 and put it in line 13 --- dead-code/exercise-1.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dead-code/exercise-1.js b/dead-code/exercise-1.js index 4d09f15fa..9cbad3530 100644 --- a/dead-code/exercise-1.js +++ b/dead-code/exercise-1.js @@ -1,7 +1,7 @@ // 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 = "Jerry"; const greeting = "hello"; function sayHello(greeting, name) { @@ -10,7 +10,7 @@ function sayHello(greeting, name) { console.log(greetingStr); } -testName = "Aman"; +let testName = "Aman"; const greetingMessage = sayHello(greeting, testName); From aa56279bafa38a3da70873c2afaee95644fcf2a7 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Tue, 27 Oct 2026 22:44:42 +0000 Subject: [PATCH 2/7] Removed the console.log statement from line 10 --- dead-code/exercise-1.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dead-code/exercise-1.js b/dead-code/exercise-1.js index 9cbad3530..06e1c898c 100644 --- a/dead-code/exercise-1.js +++ b/dead-code/exercise-1.js @@ -7,7 +7,7 @@ const greeting = "hello"; function sayHello(greeting, name) { const greetingStr = greeting + ", " + name + "!"; return `${greeting}, ${name}!`; - console.log(greetingStr); + // console.log(greetingStr); } let testName = "Aman"; From fda7d24fe4e8b9aefb5cae5d594a6d3a6c04f060 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Tue, 27 Oct 2026 22:49:25 +0000 Subject: [PATCH 3/7] Remove the const capaitalisedPets from line 5 --- dead-code/exercise-2.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dead-code/exercise-2.js b/dead-code/exercise-2.js index 56d7887c4..b6f4f93e7 100644 --- a/dead-code/exercise-2.js +++ b/dead-code/exercise-2.js @@ -2,7 +2,7 @@ // 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 capitalisedPets = pets.map((pet) => pet.toUpperCase()); const petsStartingWithH = pets.filter((pet) => pet[0] === "h"); function logPets(petsArr) { From 1c9c9b37f4658ca7e09b73f58227844699dc9279 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Tue, 27 Oct 2026 22:51:42 +0000 Subject: [PATCH 4/7] Remove the line 8 to 11 because it is not being used in the code. --- dead-code/exercise-2.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dead-code/exercise-2.js b/dead-code/exercise-2.js index b6f4f93e7..b27bf51e2 100644 --- a/dead-code/exercise-2.js +++ b/dead-code/exercise-2.js @@ -5,9 +5,9 @@ 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 logPets(petsArr) { +// petsArr.forEach((pet) => console.log(pet)); +// } function countAndCapitalisePets(petsArr) { const petCount = {}; From 55cd9b377afa0b99aaaa5521dee8ac36c2e3cee4 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Thu, 29 Oct 2026 21:44:46 +0000 Subject: [PATCH 5/7] exercise-1: Remove unreachable and redundant code --- dead-code/exercise-1.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/dead-code/exercise-1.js b/dead-code/exercise-1.js index 06e1c898c..a1d2f89b5 100644 --- a/dead-code/exercise-1.js +++ b/dead-code/exercise-1.js @@ -1,13 +1,11 @@ // 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); } let testName = "Aman"; From 103de85dcffad6c5e015536183a2d2203a21d301 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Thu, 29 Oct 2026 21:46:29 +0000 Subject: [PATCH 6/7] remove commented-out code for clarity --- 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 b27bf51e2..b1c2362d3 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 = {}; From 1431a6aee70f0368f3b497897b004f2ffcd1caf3 Mon Sep 17 00:00:00 2001 From: gaireprakash20-ops Date: Fri, 30 Oct 2026 21:52:42 +0000 Subject: [PATCH 7/7] i removed the unused variable greetingStr --- dead-code/exercise-1.js | 1 - 1 file changed, 1 deletion(-) diff --git a/dead-code/exercise-1.js b/dead-code/exercise-1.js index a1d2f89b5..2e46fba35 100644 --- a/dead-code/exercise-1.js +++ b/dead-code/exercise-1.js @@ -4,7 +4,6 @@ const greeting = "hello"; function sayHello(greeting, name) { - const greetingStr = greeting + ", " + name + "!"; return `${greeting}, ${name}!`; }