Skip to content

Commit a73b69e

Browse files
redundant code commented out for the deadcode exercise
1 parent b31a586 commit a73b69e

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

Sprint-3/3-dead-code/exercise-1.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
// Find the instances of unreachable and redundant code - remove them!
22
// The sayHello function should continue to work for any reasonable input it's given.
33

4-
let testName = "Jerry";
4+
//let testName = "Jerry";
55
const greeting = "hello";
6-
76
function sayHello(greeting, name) {
8-
const greetingStr = greeting + ", " + name + "!";
7+
// const greetingStr = greeting + ", " + name + "!";
98
return `${greeting}, ${name}!`;
10-
console.log(greetingStr);
119
}
12-
1310
testName = "Aman";
14-
1511
const greetingMessage = sayHello(greeting, testName);
16-
1712
console.log(greetingMessage); // 'hello, Aman!'

Sprint-3/3-dead-code/exercise-2.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
// Remove the unused code that does not contribute to the final console log
22
// The countAndCapitalisePets function should continue to work for any reasonable input it's given, and you shouldn't modify the pets variable.
3-
43
const pets = ["parrot", "hamster", "horse", "dog", "hamster", "cat", "hamster"];
5-
const capitalisedPets = pets.map((pet) => pet.toUpperCase());
4+
//const capitalisedPets = pets.map((pet) => pet.toUpperCase());
65
const petsStartingWithH = pets.filter((pet) => pet[0] === "h");
76

8-
function logPets(petsArr) {
9-
petsArr.forEach((pet) => console.log(pet));
10-
}
7+
//function logPets(petsArr) {
8+
// petsArr.forEach((pet) => console.log(pet));
9+
//}
1110

1211
function countAndCapitalisePets(petsArr) {
1312
const petCount = {};

0 commit comments

Comments
 (0)