So I know I went a difficult route of doing this but what am I missing to pass? I feel like my answers should pass but they don’t.
Your code so far
let email = `removed by moderator`
function maskEmail(email){
let start = email.indexOf(0)
let end = email.indexOf("@") -1
let hide = email.replace(email.slice(1, email.indexOf("@")-1), "*".repeat(end - start - 2))
return console.log(hide)
}
maskEmail("apple.pie@example.com")
maskEmail("freecodecamp@example.com")
maskEmail("info@test.dev")
maskEmail("user@domain.org")
console.log(maskEmail(email))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36 Edg/152.0.0.0
Your personal information has been removed from this post. Sharing personal information like your phone number, email, legal name and exact location online is unsafe.
It can be scraped by malicious actors to use against you, so please think carefully about what information you share.
Yeah, because I was returning the console log instead of the email itself, it wouldn’t give me the pass. After I changed it, I passed. Thank you for the idea, appreciate it.