Skip to content

Commit c81c96d

Browse files
committed
Explained the error message in 2.js
1 parent 8b85d0f commit c81c96d

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • Sprint-2/2-mandatory-errors

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44
const cityOfBirth = "Bolton";
55
console.log(`I was born in ${cityOfBirth}`);
66

7-
// Answer: I switched the lines around, so cityOfBirth gets declared before it is referenced.
7+
// Answer: I got the error message ReferenceError: Cannot access 'cityOfBirth' before initialization
8+
// This is because the program tries to access cityOfBirth before it has been initialized.
9+
// I switched the lines around, so cityOfBirth gets declared before it is referenced.

0 commit comments

Comments
 (0)