Skip to content

Commit c109c56

Browse files
committed
refactoring the code by use toStr() for dynamic values instead of % formatting
1 parent ba1300d commit c109c56

File tree

1 file changed

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

1 file changed

+1
-2
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
// .slice() called on a number, and Numbers don’t have string methods like .slice().it will throw an error
88
// console.log(last4Digits) => TypeError: cardNumber.slice is not a function at Object.
99
const cardNumber = 4533787178994213;;
10-
// const last4Digits = cardNumber.toString;
1110
const numToStr = cardNumber.toString()
1211
const last4Digits = numToStr.slice(-4)
13-
console.log(last4Digits) //===>4213
12+
// console.log(last4Digits) ===>4213

0 commit comments

Comments
 (0)