Skip to content

Commit b7a8c22

Browse files
committed
Fix variable hoisting issue by moving cityOfBirth declaration above console.log and enhance comments for clarity (2.js)
1 parent 2b12a34 commit b7a8c22

File tree

1 file changed

+3
-0
lines changed
  • Sprint-1/2-mandatory-errors

1 file changed

+3
-0
lines changed

Sprint-1/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+
8+
// Code is executed line by line so the variable cityOfBirth is not defined when it is called in the console.log line.

0 commit comments

Comments
 (0)