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 7309397 commit ba1300dCopy full SHA for ba1300d
Sprint-1/2-mandatory-errors/3.js
@@ -6,7 +6,8 @@
6
// Then try updating the expression last4Digits is assigned to, in order to get the correct value
7
// .slice() called on a number, and Numbers don’t have string methods like .slice().it will throw an error
8
// console.log(last4Digits) => TypeError: cardNumber.slice is not a function at Object.
9
-const cardNumber = 4533787178994213;
+const cardNumber = 4533787178994213;;
10
// const last4Digits = cardNumber.toString;
11
-const last4Digits = cardNumber % 10000;
12
-console.log(last4Digits)
+const numToStr = cardNumber.toString()
+const last4Digits = numToStr.slice(-4)
13
+console.log(last4Digits) //===>4213
0 commit comments