Skip to content

Commit 0373f01

Browse files
committed
updates
1 parent d34b2e1 commit 0373f01

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

Sprint-3/3-dead-code/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Refactoring Dead Code
2+
3+
Here are two example of code that has not been built efficiently. Both files have dead code in them. It's your job to go back through this existing code, identify the dead code, and remove it so the code is ready for production.
4+
5+
## Instructions
6+
7+
1. Work through each `exercise` file inside this directory.
8+
2. Delete the dead code.
9+
3. Commit your changes and make a PR when done.
10+
// commit

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
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"; - redundant
4+
55
const greeting = "hello";
66

77
function sayHello(greeting, name) {
8-
// const greetingStr = greeting + ", " + name + "!"; - redundant
8+
99
return `${greeting}, ${name}!`;
10-
// console.log(greetingStr); - redundant
10+
1111
}
1212

1313
testName = "Aman";

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33

44

55
const pets = ["parrot", "hamster", "horse", "dog", "hamster", "cat", "hamster"];
6-
// const capitalisedPets = pets.map((pet) => pet.toUpperCase()); - redundant
6+
77
const petsStartingWithH = pets.filter((pet) => pet[0] === "h");
88

99

10-
// function logPets(petsArr) {
11-
// petsArr.forEach((pet) => console.log(pet));
12-
// } - redundant
1310

1411

1512
function countAndCapitalisePets(petsArr) {

0 commit comments

Comments
 (0)