Skip to content

Commit 245bf0f

Browse files
committed
Sprint 1 errors: explain 2.js temporal dead zone error
1 parent 723da0c commit 245bf0f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Sprint-1/2-mandatory-errors/answers.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@
2020
- Error shown:
2121
- Why it happens:
2222
- MDN link (optional):
23+
- Error shown: `ReferenceError: Cannot access 'cityOfBirth' before initialization`.
24+
- Why it happens: The variable `cityOfBirth` is declared later in the file using `let` or `const`, but it is used before that declaration. JavaScript does not allow access to `let`/`const` variables before initialization (temporal dead zone).
25+
- MDN link: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cant_access_lexical_declaration_before_init
26+
2327

2428
## 3.js
2529
- Error shown:

0 commit comments

Comments
 (0)