Created
March 15, 2019 05:44
-
-
Save asifvora/93c9ebc63501b7c455731ef3a6617aeb to your computer and use it in GitHub Desktop.
Create a function that masks a string of characters with # except for the last four (4) characters.
This file contains 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
const mask = (str, maskChar = "#") => str.slice(-4).padStart(str.length, maskChar); | |
mask("123456789"); // "#####6789" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment