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 2e44be5 commit 21f66d6Copy full SHA for 21f66d6
Sprint-1/2-mandatory-errors/2.js
@@ -1,5 +1,10 @@
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
const cityOfBirth = "Bolton";
+console.log(`I was born in ${cityOfBirth}`);
6
+
7
+// The error is that cityOfBirth is used before it is declared.
8
+// In JavaScript, variables declared with const or let cannot be accessed before their declaration due to the temporal dead zone.
9
+// To fix the error, we need to declare and initialize cityOfBirth before using it in the console.log statement.
10
0 commit comments