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 34cf88c commit eff1a8fCopy full SHA for eff1a8f
Sprint-1/2-mandatory-errors/2.js
@@ -1,5 +1,13 @@
1
// Currently trying to print the string "I was born in Bolton" but it isn't working...
2
// what's the error ?
3
4
-console.log(`I was born in ${cityOfBirth}`);
+/*
5
+This happens because in JavaScript, variables declared with `let` or `const` are not accessible before their declaration
6
+due to a behavior called the **temporal dead zone**.
7
+If you try to use such a variable before it’s initialized, you get a `ReferenceError`.
8
+To avoid this, always declare and assign your variables before using them.
9
+
10
+*/
11
const cityOfBirth = "Bolton";
12
+console.log(`I was born in ${cityOfBirth}`);
13
0 commit comments