Skip to content

Commit e3ae3a8

Browse files
committed
Fix error caused by using const before declaration
1 parent cbbe383 commit e3ae3a8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • Sprint-1/2-mandatory-errors

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Currently trying to print the string "I was born in Bolton" but it isn't working...
22
// what's the error ?
3-
4-
console.log(`I was born in ${cityOfBirth}`);
3+
// The error happens because cityOfBirth is used before it is declared,
4+
// Variables declared with const cannot be accessed before their declaration.
55
const cityOfBirth = "Bolton";
6+
console.log(`I was born in ${cityOfBirth}`);

0 commit comments

Comments
 (0)