Skip to content

Commit 09fe0dc

Browse files
committed
changed the number to a string in errors 3.js
1 parent aedf01f commit 09fe0dc

File tree

1 file changed

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

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
const cardNumber = 4533787178994213;
1+
const cardNumber = '4533787178994213';
22
const last4Digits = cardNumber.slice(-4);
33

4+
// A number was not able to be sliced, whereas a string can be sliced
5+
// So, the error is that cardNumber should be a string, not a number
6+
console.log(last4Digits);
7+
48
// The last4Digits variable should store the last 4 digits of cardNumber
59
// However, the code isn't working
610
// Before running the code, make and explain a prediction about why the code won't work

0 commit comments

Comments
 (0)