There was an error while loading. Please reload this page.
1 parent caf0ecd commit b2957b1Copy full SHA for b2957b1
1 file changed
Sprint-2/2-mandatory-errors/2.js
@@ -1,8 +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
-// Error: ReferenceError: Cannot access 'cityOfBirth' before initialization
8
-// Why: cityOfBirth is used before it is declared.
+// Error: ReferenceError:
9
+// Why: Cannot access 'cityOfBirth' before initialization
10
+// Fix: Declare the const before using it
0 commit comments