Skip to content

Commit 8a5a9f0

Browse files
fix; revert to original
1 parent a0be617 commit 8a5a9f0

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

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

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ let testName = "Jerry";
55
const greeting = "hello";
66

77
function sayHello(greeting, name) {
8-
// const greetingStr = greeting + ", " + name + "!"; this line will also be removed because the we're trying to return something else, not the greetingStr and apparently it is a redundant code
8+
const greetingStr = greeting + ", " + name + "!";
99
return `${greeting}, ${name}!`;
10-
// console.log(greetingStr); this line will obviously be omitted as it is unreachable code because it is written after return. In fact, anything after return is not reachable and should be get rid of
10+
console.log(greetingStr);
1111
}
1212

13+
testName = "Aman";
14+
1315
const greetingMessage = sayHello(greeting, testName);
14-
console.log(greetingMessage);
16+
17+
console.log(greetingMessage); // 'hello, Aman!'

0 commit comments

Comments
 (0)