Skip to content

Commit 56ac4cd

Browse files
completed 2.js by swapping lines 6 and 5 so that const decleration is before console.log
1 parent 80746e7 commit 56ac4cd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

  • Sprint-2/2-mandatory-errors

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// Currently trying to print the string "I was born in Bolton" but it isn't working...
22
// what's the error ?
3+
// Answer: because javascript runs from top to bottom, by declaring the const after running console.log the function throws an error because the decleration is done ater console.log
34

4-
console.log(`I was born in ${cityOfBirth}`);
55
const cityOfBirth = "Bolton";
6+
console.log(`I was born in ${cityOfBirth}`);
7+

0 commit comments

Comments
 (0)