Skip to content

Commit 2c2e03d

Browse files
Explain variable initialization error
1 parent 38f37a7 commit 2c2e03d

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

  • Sprint-2/2-mandatory-errors

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@
33

44
console.log(`I was born in ${cityOfBirth}`);
55
const cityOfBirth = "Bolton";
6+
7+
// Error: ReferenceError: Cannot access 'cityOfBirth' before initialization
8+
// Why: cityOfBirth is used before it is declared.

0 commit comments

Comments
 (0)