Skip to content

Commit 58e31bf

Browse files
committed
added explanation for answer
1 parent a5119eb commit 58e31bf

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

  • Sprint-2/2-mandatory-errors

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ const last4Digits = `${cardNumber}`.slice(-4);
1111
// Card Number is declared as a number and not a string, so slice won't work.
1212
console.log(last4Digits);
1313
// Yes this is what I predicted. The error is - cardNumber.slice is not a function.
14+
// I used a template literal because it will automatically convert the number to a string before slicing.

0 commit comments

Comments
 (0)