Skip to content

Commit ad67e7b

Browse files
committed
Answer to 2-mandatory-errors/2.js included as text
1 parent aa7d600 commit ad67e7b

File tree

1 file changed

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

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33

44
console.log(`I was born in ${cityOfBirth}`);
55
const cityOfBirth = "Bolton";
6+
//problem: we are trying to use the variable "cityOfBirth" before it has been declared and assigned a value. In JavaScript, variables declared with "const" or "let" cannot be accessed before they are declared. To fix this error, we need to declare and assign a value to "cityOfBirth" before we try to use it. So we would move the line "const cityOfBirth = "Bolton";" above the console.log statement.

0 commit comments

Comments
 (0)