You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// The last4Digits variable should store the last 4 digits of cardNumber
5
7
// However, the code isn't working
6
8
// Before running the code, make and explain a prediction about why the code won't work
9
+
// Answer: Missing console.log
7
10
// Then run the code and see what error it gives.
11
+
// Error:we had TypeError: cardNumber.slice is not a function
8
12
// Consider: Why does it give this error? Is this what I predicted? If not, what's different?
13
+
// "cardNumber.slice" must declared as a function, this is not what i thought, the difference is that the code is incomplete and so will add a function
9
14
// Then try updating the expression last4Digits is assigned to, in order to get the correct value
15
+
16
+
17
+
// After some research i found out that ".slice()" only works on strings so we have to convert the numbers into a string first
0 commit comments