We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ffbb9a4 commit 013ef5eCopy full SHA for 013ef5e
1 file changed
Sprint-1/2-mandatory-errors/3.js
@@ -1,5 +1,5 @@
1
-const cardNumber = "4533787178994213";
2
-const last4Digits = cardNumber.slice(-4);
+const cardNumber = 4533787178994213;
+const last4Digits = String(cardNumber).slice(-4);
3
4
// The last4Digits variable should store the last 4 digits of cardNumber
5
// However, the code isn't working
@@ -11,4 +11,6 @@ const last4Digits = cardNumber.slice(-4);
11
//Prediction: I believe the code won't work because the slice method is incorrect. The slice method is used for strings.
12
//Error: TypeError: cardNumber.slice is not a function
13
//Needed to add "" to make it a string.
14
+//if not possible, I can change make the last4Digits = String(cardNumber).slice(-4);
15
+// to make last4Digits to convert cardNumber into a string
16
0 commit comments