There was an error while loading. Please reload this page.
1 parent dc97183 commit 8ada20cCopy full SHA for 8ada20c
1 file changed
Sprint-2/2-mandatory-errors/2.js
@@ -1,5 +1,12 @@
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}`);
+// The error is a ReferenceError: Cannot access 'cityOfBirth' before initialization
5
+// In JavaScript variables declared with 'const' or 'let' cannot be accessed before they are declared or initialized
6
+
7
8
+//SOLUTION
9
+// move the variable declaration above the 'console.log()'
10
const cityOfBirth = "Bolton";
11
12
+console.log(`I was born in ${cityOfBirth}`);
0 commit comments