From c09ebf429d750444155a68066b1ae40ad6910964 Mon Sep 17 00:00:00 2001 From: Khaliun Baatarkhuu Date: Thu, 5 Mar 2026 14:53:24 +0000 Subject: [PATCH 1/2] Refactor sayHello function to use template literals Removed unnecessary variable and console log from sayHello function. --- Sprint-3/3-dead-code/exercise-1.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprint-3/3-dead-code/exercise-1.js b/Sprint-3/3-dead-code/exercise-1.js index 4d09f15fa9..fd23e6c390 100644 --- a/Sprint-3/3-dead-code/exercise-1.js +++ b/Sprint-3/3-dead-code/exercise-1.js @@ -5,9 +5,9 @@ let testName = "Jerry"; const greeting = "hello"; function sayHello(greeting, name) { - const greetingStr = greeting + ", " + name + "!"; + return `${greeting}, ${name}!`; - console.log(greetingStr); + } testName = "Aman"; From eab632103c10a45dbcb02c04839751cf87c55198 Mon Sep 17 00:00:00 2001 From: Khaliun Baatarkhuu Date: Fri, 6 Mar 2026 08:34:20 +0000 Subject: [PATCH 2/2] Remove dead code from exercise-2.js Removed unused code related to logging pets and capitalizing them. --- Sprint-3/3-dead-code/exercise-2.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Sprint-3/3-dead-code/exercise-2.js b/Sprint-3/3-dead-code/exercise-2.js index 56d7887c4c..0a483fdef8 100644 --- a/Sprint-3/3-dead-code/exercise-2.js +++ b/Sprint-3/3-dead-code/exercise-2.js @@ -2,12 +2,9 @@ // 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 = {};