Skip to content

Commit c4049e2

Browse files
committed
Add prediction and explanation comments for cardNumber slicing issue
1 parent 1d0d876 commit c4049e2

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • Sprint-2/2-mandatory-errors

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@ 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+
12+
//Solution
13+
//Prediction - The code would not run because 'cardNumber' is declared as numbers instead of a string.
14+
// The '.slice()' method belongs to strings and arrays, it could only work by treating it's subject as a sequence of characters.

0 commit comments

Comments
 (0)