Skip to content

Commit e8e9f51

Browse files
committed
state the error and reason in sprint 2 error 2
1 parent 915b09f commit e8e9f51

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

  • Sprint-2/2-mandatory-errors

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

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

7-
//reason is the console.log was entered before the text
7+
// the error is ReferenceError: Cannot access 'cityOfBirth' before initialization,
8+
// reason is the console.log was entered before the variable declaration.
9+
// Console.log cannot run something that is not there yet.
10+
// To fix it , move the const declaration above the console.log
811

0 commit comments

Comments
 (0)