Skip to content

Commit 7e294c8

Browse files
authored
Fix ReferenceError by declaring cityOfBirth first
Fixed the order of variable declaration and usage for cityOfBirth.
1 parent 918f3c4 commit 7e294c8

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • Sprint-2/2-mandatory-errors

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Currently trying to print the string "I was born in Bolton" but it isn't working...
2-
// what's the error?
2+
// what's the error?in the original code,line 4 creates it and line 3 uses the createOfBirth,Then I changed console.log to the next line because we need to declare the variable before using it.
33
//ReferenceError: Cannot access 'cityOfBirth' before initialization
44

55
const cityOfBirth = "Bolton";

0 commit comments

Comments
 (0)