Skip to content

Commit b9538b2

Browse files
committed
Variable must be declared first before it can be used
1 parent 204a98d commit b9538b2

File tree

1 file changed

+5
-1
lines changed
  • Sprint-1/2-mandatory-errors

1 file changed

+5
-1
lines changed

Sprint-1/2-mandatory-errors/2.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Currently trying to print the string "I was born in Bolton" but it isn't working...
22
// what's the error ?
33

4-
console.log(`I was born in ${cityOfBirth}`);
4+
// this is a very common JavaScript error related to variable hoisting and the temporal dead zone.
5+
// Simply declare the variable before you use it
6+
57
const cityOfBirth = "Bolton";
8+
console.log(`I was born in ${cityOfBirth}`);
9+

0 commit comments

Comments
 (0)