Skip to content

Commit 28eeec9

Browse files
used .slice to extrat the last 4 digits from the cardNumberString
1 parent cd37090 commit 28eeec9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • Sprint-1/2-mandatory-errors

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const cardNumber = 4533787178994213;
22
//console.log(typeof cardNumber);
33
const cardNumberString = cardNumber.toString();
44

5-
const last4Digits = cardNumber.slice(-4);
5+
const last4Digits = cardNumberString.slice(-4);
66
console.log(last4Digits); // Output: "4213"
77

88
// The last4Digits variable should store the last 4 digits of cardNumber

0 commit comments

Comments
 (0)