Skip to content

Commit d71e824

Browse files
committed
Remove dead code from exercise-1 and exercise-2
1 parent 29ef74a commit d71e824

2 files changed

Lines changed: 1 addition & 13 deletions

File tree

‎dead-code/exercise-1.js‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,9 @@
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";
5-
const greeting = "hello";
6-
74
function sayHello(greeting, name) {
8-
const greetingStr = greeting + ", " + name + "!";
95
return `${greeting}, ${name}!`;
10-
console.log(greetingStr);
116
}
127

13-
testName = "Aman";
14-
15-
const greetingMessage = sayHello(greeting, testName);
8+
console.log(sayHello("hello", "Aman")); // 'hello, Aman!'
169

17-
console.log(greetingMessage); // 'hello, Aman!'

‎dead-code/exercise-2.js‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,8 @@
22
// The countAndCapitalisePets function should continue to work for any reasonable input it's given, and you shouldn't modify the pets variable.
33

44
const pets = ["parrot", "hamster", "horse", "dog", "hamster", "cat", "hamster"];
5-
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-
}
117

128
function countAndCapitalisePets(petsArr) {
139
const petCount = {};

0 commit comments

Comments
 (0)