Skip to content

Commit c9e436f

Browse files
authored
Fix last4Digits extraction for cardNumber
Convert cardNumber to string before slicing to ensure proper extraction of last 4 digits.
1 parent ee21a6a commit c9e436f

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
@@ -11,4 +11,4 @@ const cardNumber = 4533787178994213;
1111
// [ChunYanWong] The slice method extract substring starting with the first parameter position
1212
// There is no -4 starting position and hence it will not work
1313

14-
const last4Digits = cardNumber.slice(cardNumber.length - 4)
14+
const last4Digits = cardNumber.toString().slice(cardNumber.length - 4)

0 commit comments

Comments
 (0)