There was an error while loading. Please reload this page.
1 parent 0fc0771 commit 80bc588Copy full SHA for 80bc588
1 file changed
Sprint-2/2-mandatory-errors/3.js
@@ -1,5 +1,7 @@
1
const cardNumber = 4533787178994213;
2
-const last4Digits = cardNumber.slice(-4);
+// Convert the number to a string before slicing to get the last four digits.
3
+const last4Digits = String(cardNumber).slice(-4);
4
+console.log(last4Digits);
5
6
// The last4Digits variable should store the last 4 digits of cardNumber
7
// However, the code isn't working
0 commit comments