Skip to content

Commit 4d64b5e

Browse files
committed
fix(sprint-1): resolve SyntaxError by using unique variable names
1 parent 78c9889 commit 4d64b5e

File tree

1 file changed

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

1 file changed

+9
-2
lines changed

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

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

4-
console.log(`I was born in ${cityOfBirth}`);
4+
// console.log(`I was born in ${cityOfBirth}`);
5+
// const cityOfBirth = "Bolton";
6+
7+
// ReferenceError: Cannot access 'cityOfBirth' before initialization - temporal dead zone
8+
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const#temporal_dead_zone_tdz
9+
10+
// Solution:
511
const cityOfBirth = "Bolton";
12+
console.log(`I was born in ${cityOfBirth}`);

0 commit comments

Comments
 (0)