Skip to content

Commit 1383234

Browse files
committed
Add comments to explain the errors
1 parent ea93025 commit 1383234

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22

33
let age = 33;
44
age = age + 1;
5+
6+
// You cannot mutate a constant so you need to change it to a variable where mutation is permitted

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33

44
const cityOfBirth = "Bolton";
55
console.log(`I was born in ${cityOfBirth}`);
6+
7+
// The order of the code matters, the constant needs to be defined first before it can be used

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ const last4Digits = `${cardNumber}`.slice(-4)
77
// Then run the code and see what error it gives.
88
// Consider: Why does it give this error? Is this what I predicted? If not, what's different?
99
// Then try updating the expression last4Digits is assigned to, in order to get the correct value
10+
11+
// slice() function only work on String type and not on Number type.
12+
// So, convert the Number type into a String type in order to use slice() function

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
const _12HourClockTime = "20:53";
2-
const _24hourClockTime = "08:53";
2+
const _24hourClockTime = "08:53";
3+
4+
// Variables and constants name cannot begin with a number but can include number later on

0 commit comments

Comments
 (0)