From 28385eb58b31ad6d610e2fca118e295b255b352b Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Wed, 29 Jul 2026 12:42:20 +0100 Subject: [PATCH 01/21] add exercise 1 --- 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 533f258dd7089c7e2cb3523ac53ca2b73fce98a5 Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Wed, 29 Jul 2026 16:32:37 +0100 Subject: [PATCH 02/21] dead code2 --- Sprint-3/3-dead-code/exercise-2.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Sprint-3/3-dead-code/exercise-2.js b/Sprint-3/3-dead-code/exercise-2.js index 56d7887c4..140f9699c 100644 --- a/Sprint-3/3-dead-code/exercise-2.js +++ b/Sprint-3/3-dead-code/exercise-2.js @@ -1,13 +1,6 @@ -// Remove the unused code that does not contribute to the final console log -// 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 = {}; @@ -25,4 +18,4 @@ function countAndCapitalisePets(petsArr) { const countedPetsStartingWithH = countAndCapitalisePets(petsStartingWithH); -console.log(countedPetsStartingWithH); // { 'HAMSTER': 3, 'HORSE': 1 } <- Final console log +console.log(countedPetsStartingWithH); // { 'HAMSTER': 3, 'HORSE': 1 } From e948c205ea33965fdc46cd76d2a80cc4b1d4cbff Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Thu, 30 Jul 2026 09:42:24 +0100 Subject: [PATCH 03/21] simplify testName --- Sprint-3/3-dead-code/exercise-1.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/Sprint-3/3-dead-code/exercise-1.js b/Sprint-3/3-dead-code/exercise-1.js index 5de7eb4ba..8547707a4 100644 --- a/Sprint-3/3-dead-code/exercise-1.js +++ b/Sprint-3/3-dead-code/exercise-1.js @@ -1,15 +1,19 @@ // 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"; +// let testName = "Aman"; +// const greeting = "hello"; + +// function sayHello(greeting, name) { +// return `${greeting}, ${name}!`; +// } + +// console.log(sayHello(greeting, testName)); +// // "hello, Aman!" function sayHello(greeting, name) { return `${greeting}, ${name}!`; } -testName = "Aman"; - -const greetingMessage = sayHello(greeting, testName); - -console.log(greetingMessage); // 'hello, Aman!' +console.log(sayHello("hello", "Aman")); +// "hello, Aman!" From 5c69310b2eaa2200b268ff8be0c74bae90f0dd62 Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Sat, 1 Aug 2026 14:16:36 +0100 Subject: [PATCH 04/21] fix errors --- Sprint-3/3-dead-code/exercise-1.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/Sprint-3/3-dead-code/exercise-1.js b/Sprint-3/3-dead-code/exercise-1.js index 8547707a4..eb1baff1e 100644 --- a/Sprint-3/3-dead-code/exercise-1.js +++ b/Sprint-3/3-dead-code/exercise-1.js @@ -1,16 +1,6 @@ // 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 = "Aman"; -// const greeting = "hello"; - -// function sayHello(greeting, name) { -// return `${greeting}, ${name}!`; -// } - -// console.log(sayHello(greeting, testName)); -// // "hello, Aman!" - function sayHello(greeting, name) { return `${greeting}, ${name}!`; } From b1e438e6c70f1b14ba706b3432adb9c11727a3b0 Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Sat, 1 Aug 2026 14:17:01 +0100 Subject: [PATCH 05/21] fix sprint --- Sprint-3/2-practice-tdd/count.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index 95b6ebb7d..5407c3d7e 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -1,5 +1,13 @@ function countChar(stringOfCharacters, findCharacter) { - return 5 + let count = 0; + + for (const char of stringOfCharacters) { + if (char === findCharacter) { + count++; + } + } + + return count; } module.exports = countChar; From d22a09cf079420be8b717741a2e2a207e2b4b707 Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Wed, 5 Aug 2026 12:34:56 +0100 Subject: [PATCH 06/21] replace original files in dead code --- Sprint-3/2-practice-tdd/count.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index 5407c3d7e..99cd163d9 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -1,13 +1,5 @@ function countChar(stringOfCharacters, findCharacter) { - let count = 0; - - for (const char of stringOfCharacters) { - if (char === findCharacter) { - count++; - } - } - - return count; + return 5; } module.exports = countChar; From f608dfae998840d46ebd1ce081f9b0bd42bef02e Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Tue, 27 Oct 2026 19:27:19 +0000 Subject: [PATCH 07/21] deadcode 1 --- Sprint-3/3-dead-code/exercise-1.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Sprint-3/3-dead-code/exercise-1.js b/Sprint-3/3-dead-code/exercise-1.js index eb1baff1e..5de7eb4ba 100644 --- a/Sprint-3/3-dead-code/exercise-1.js +++ b/Sprint-3/3-dead-code/exercise-1.js @@ -1,9 +1,15 @@ // 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) { return `${greeting}, ${name}!`; } -console.log(sayHello("hello", "Aman")); -// "hello, Aman!" +testName = "Aman"; + +const greetingMessage = sayHello(greeting, testName); + +console.log(greetingMessage); // 'hello, Aman!' From 058c0152b5c5727d9874f1dfb352ae61bb32ff73 Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Tue, 27 Oct 2026 19:27:23 +0000 Subject: [PATCH 08/21] Deadcode 1 --- Sprint-3/3-dead-code/exercise-2.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Sprint-3/3-dead-code/exercise-2.js b/Sprint-3/3-dead-code/exercise-2.js index 140f9699c..17aa4ef04 100644 --- a/Sprint-3/3-dead-code/exercise-2.js +++ b/Sprint-3/3-dead-code/exercise-2.js @@ -1,21 +1,23 @@ const pets = ["parrot", "hamster", "horse", "dog", "hamster", "cat", "hamster"]; -const petsStartingWithH = pets.filter((pet) => pet[0] === "h"); - function countAndCapitalisePets(petsArr) { const petCount = {}; petsArr.forEach((pet) => { const capitalisedPet = pet.toUpperCase(); + if (petCount[capitalisedPet]) { petCount[capitalisedPet] += 1; } else { petCount[capitalisedPet] = 1; } }); + return petCount; } -const countedPetsStartingWithH = countAndCapitalisePets(petsStartingWithH); +const countedPetsStartingWithH = countAndCapitalisePets( + pets.filter((pet) => pet.startsWith("h")) +); -console.log(countedPetsStartingWithH); // { 'HAMSTER': 3, 'HORSE': 1 } +console.log(countedPetsStartingWithH); // { HAMSTER: 3, HORSE: 1 } From d16106cc7baf8644cd38fe6634bebc081e16bdc6 Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Wed, 28 Oct 2026 18:30:06 +0000 Subject: [PATCH 09/21] dead code exp1 --- Sprint-3/3-dead-code/exercise-1.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Sprint-3/3-dead-code/exercise-1.js b/Sprint-3/3-dead-code/exercise-1.js index 5de7eb4ba..a16daa17b 100644 --- a/Sprint-3/3-dead-code/exercise-1.js +++ b/Sprint-3/3-dead-code/exercise-1.js @@ -1,14 +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"; const greeting = "hello"; function sayHello(greeting, name) { return `${greeting}, ${name}!`; } -testName = "Aman"; +const testName = "Aman"; const greetingMessage = sayHello(greeting, testName); From d782ddb6e1e20d16b808e05010a5c609a7ac1ca9 Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Wed, 28 Oct 2026 18:32:03 +0000 Subject: [PATCH 10/21] deadcode2 --- 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 17aa4ef04..595785ebb 100644 --- a/Sprint-3/3-dead-code/exercise-2.js +++ b/Sprint-3/3-dead-code/exercise-2.js @@ -1,23 +1,20 @@ const pets = ["parrot", "hamster", "horse", "dog", "hamster", "cat", "hamster"]; +const petsStartingWithH = pets.filter((pet) => pet[0] === "h"); function countAndCapitalisePets(petsArr) { const petCount = {}; petsArr.forEach((pet) => { const capitalisedPet = pet.toUpperCase(); - if (petCount[capitalisedPet]) { petCount[capitalisedPet] += 1; } else { petCount[capitalisedPet] = 1; } }); - return petCount; } -const countedPetsStartingWithH = countAndCapitalisePets( - pets.filter((pet) => pet.startsWith("h")) -); +const countedPetsStartingWithH = countAndCapitalisePets(petsStartingWithH); -console.log(countedPetsStartingWithH); // { HAMSTER: 3, HORSE: 1 } +console.log(countedPetsStartingWithH); // { 'HAMSTER': 3, 'HORSE': 1 } From 3383acfff1a04db2596ccef61952cc1fba9fd7e3 Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Wed, 28 Oct 2026 18:36:10 +0000 Subject: [PATCH 11/21] fix count.js --- Sprint-3/2-practice-tdd/count.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index 99cd163d9..5518c5712 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -1,5 +1,3 @@ -function countChar(stringOfCharacters, findCharacter) { - return 5; +export function countChar(stringOfCharacters, findCharacter) { + return 5 } - -module.exports = countChar; From aef6843ed12dcab879c6b2fc246fa5b5f9cdc16e Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Wed, 28 Oct 2026 18:44:14 +0000 Subject: [PATCH 12/21] count --- Sprint-3/2-practice-tdd/count.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index 5518c5712..1a099f60f 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -1,3 +1,3 @@ export function countChar(stringOfCharacters, findCharacter) { - return 5 + return 5; } From a455744e1d6a1f8cf16d58866c123a65d5bff983 Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Wed, 28 Oct 2026 19:14:40 +0000 Subject: [PATCH 13/21] replacing count.js --- Sprint-3/2-practice-tdd/count.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index 1a099f60f..84cbed33f 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -1,3 +1,3 @@ export function countChar(stringOfCharacters, findCharacter) { return 5; -} +} \ No newline at end of file From 03c4cd08660d96a73ade86c408c852ce8252771e Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Sat, 31 Oct 2026 14:45:03 +0000 Subject: [PATCH 14/21] fixing count.js --- Sprint-3/2-practice-tdd/count.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index 84cbed33f..433b315ff 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -1,3 +1,3 @@ export function countChar(stringOfCharacters, findCharacter) { - return 5; + return 5 } \ No newline at end of file From 3c0f2af67ff866debfc6df85a719816f32002329 Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Sat, 31 Oct 2026 15:00:13 +0000 Subject: [PATCH 15/21] fix count.js --- Sprint-3/2-practice-tdd/count.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index 433b315ff..5518c5712 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -1,3 +1,3 @@ export function countChar(stringOfCharacters, findCharacter) { return 5 -} \ No newline at end of file +} From bb2ad3d52c2a31c434cceecdf7729b79337a08a8 Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Sat, 31 Oct 2026 15:01:45 +0000 Subject: [PATCH 16/21] fix again --- Sprint-3/2-practice-tdd/count.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index 5518c5712..433b315ff 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -1,3 +1,3 @@ export function countChar(stringOfCharacters, findCharacter) { return 5 -} +} \ No newline at end of file From 43d8c52a2d3f63c87be2eeb7494492a135721fc1 Mon Sep 17 00:00:00 2001 From: mandipsanger Date: Sat, 31 Oct 2026 15:03:08 +0000 Subject: [PATCH 17/21] Update count.js --- Sprint-3/2-practice-tdd/count.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index 433b315ff..5518c5712 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -1,3 +1,3 @@ export function countChar(stringOfCharacters, findCharacter) { return 5 -} \ No newline at end of file +} From 4125a130569f81562592c899cc8ddc646d4e3d60 Mon Sep 17 00:00:00 2001 From: mandip sanger Date: Sat, 31 Oct 2026 16:23:30 +0000 Subject: [PATCH 18/21] fix --- Sprint-3/2-practice-tdd/count.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index 5518c5712..433b315ff 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -1,3 +1,3 @@ export function countChar(stringOfCharacters, findCharacter) { return 5 -} +} \ No newline at end of file From 8aaca2126483efa48d27c7ad2c199d1462f26050 Mon Sep 17 00:00:00 2001 From: mandipsanger Date: Sat, 31 Oct 2026 16:24:38 +0000 Subject: [PATCH 19/21] Update count.js --- Sprint-3/2-practice-tdd/count.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sprint-3/2-practice-tdd/count.js b/Sprint-3/2-practice-tdd/count.js index 433b315ff..5518c5712 100644 --- a/Sprint-3/2-practice-tdd/count.js +++ b/Sprint-3/2-practice-tdd/count.js @@ -1,3 +1,3 @@ export function countChar(stringOfCharacters, findCharacter) { return 5 -} \ No newline at end of file +} From 067d16209cbf1c6095bbeabaf8ca5fb90b8b9876 Mon Sep 17 00:00:00 2001 From: mandipsanger Date: Sat, 31 Oct 2026 16:25:01 +0000 Subject: [PATCH 20/21] Fix countChar function return value From 4eb1b5ab5ba98811206809dcae589879c4f56053 Mon Sep 17 00:00:00 2001 From: mandipsanger Date: Sat, 31 Oct 2026 16:26:06 +0000 Subject: [PATCH 21/21] Fix countChar function to return correct value