Skip to content

Commit 77f51a4

Browse files
fix: extract last 4 digits using type conversion
1 parent 4602c77 commit 77f51a4

File tree

1 file changed

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

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
const cardNumber = "4533787178994213";
2-
const last4Digits = cardNumber.slice(-4);
1+
const cardNumber = 4533787178994213;
2+
const last4Digits = Number(String(cardNumber).slice(-4));
33
console.log(last4Digits);
44

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

0 commit comments

Comments
 (0)