1
1
mirror of https://github.com/theoludwig/programming-challenges.git synced 2025-05-18 12:02:53 +02:00

Add "maskify-card-number" challenge

This commit is contained in:
Divlo
2020-07-05 20:30:27 +02:00
parent 3d4aa20915
commit dd075269f2
5 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,4 @@
# typescript-maskify - maskify-card-number
Programming language : TypeScript
Created by [@Divlo](https://github.com/Divlo) at 5 July 2020.

View File

@ -0,0 +1,11 @@
function solution (string: string) {
return string
.split('')
.map((character, index) => {
if (string.length - 4 > index) return '#'
return character
})
.join('')
}
export default solution