Last active
July 18, 2022 12:31
-
-
Save MVAodhan/c76ecaaada95c98e7e633f8a237cf793 to your computer and use it in GitHub Desktop.
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 hideEmail = (email) => { | |
let emailParts = email.split('@'); | |
let letters = [...emailParts[0]]; | |
let lettersCopy = [...letters] | |
const first = lettersCopy.shift() | |
const last = lettersCopy.pop() | |
let blanks = [] | |
for (let letter of lettersCopy) { | |
blanks.push('*') | |
} | |
let joinedBlanks =blanks.join('') | |
let blankedEmail = `${first}${joinedBlanks}${last}@${emailParts[1]}`; | |
return blankedEmail | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment