Skip to content

Commit 7ae8d3a

Browse files
reorder code to declare cityOfBirth before usage in console.log to solve the error
1 parent d41194c commit 7ae8d3a

File tree

1 file changed

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

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
// Currently trying to print the string "I was born in Bolton" but it isn't working...
22
// what's the error ?
33

4-
console.log(`I was born in ${cityOfBirth}`);
4+
// console.log(`I was born in ${cityOfBirth}`);
5+
// const cityOfBirth = "Bolton";
6+
7+
// The error is that `cityOfBirth` is being used before it has been declared.
8+
// To fix this, we needed to declare `cityOfBirth` before using it in the console.log statement.
9+
10+
// Here's the corrected code:
511
const cityOfBirth = "Bolton";
12+
console.log(`I was born in ${cityOfBirth}`);

0 commit comments

Comments
 (0)