We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b3b6efd commit 9a73d7cCopy full SHA for 9a73d7c
Sprint-3/3-dead-code/exercise-1.js
@@ -6,6 +6,11 @@ function sayHello(greeting, name) {
6
return `${greeting}, ${name}!`;
7
}
8
9
-testName = "Aman";
10
-const greetingMessage = sayHello(greeting, testName);
11
-console.log(greetingMessage); // 'hello, Aman!'
+// Avoid polluting the global scope by keeping example data local
+function demo() {
+ const testName = "Aman"; // local variable
12
+ const greetingMessage = sayHello(greeting, testName);
13
+ console.log(greetingMessage); // 'hello, Aman!'
14
+}
15
+
16
+demo();
0 commit comments