Skip to content

Commit 5308baa

Browse files
Alex JamshidiAlex Jamshidi
authored andcommitted
solution to 2.js added
1 parent adbf420 commit 5308baa

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • Sprint-1/2-mandatory-errors

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

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

44
console.log(`I was born in ${cityOfBirth}`);
55
const cityOfBirth = "Bolton";
6+
7+
// error message: ReferenceError: Cannot access 'cityOfBirth' before initialization
8+
// this is occurring as the computer runs the code from top to bottom
9+
// the variable cityOfBirth is assigned in line 5 but is trying to be run in line 4
10+
// this could be fixed by swapping the lines around

0 commit comments

Comments
 (0)