Last active
August 28, 2019 14:12
-
-
Save johnhutchins/ba15cc80cd7fffa4f0ee6ffdb32aa045 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// return masked string where only last 4 digits are shown | |
function maskify(cc) { | |
if (cc.length>4){ | |
var masked = ''; | |
for(i=0;i<cc.length-4;i++){ | |
masked += cc[i].replace(cc[i], '#'); | |
} | |
masked += cc.substring(cc.length-4, cc.length); | |
return masked; | |
} else { | |
return cc; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment