function isValidEmail(e) {
const b = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return b.test((e + "").toLowerCase())
}
1. The valid email address n@ai (which used to be the real maintained email address of Ian Goldberg) doesn't pass this function. People can put DNS records on TLDs.2. You're calling toLowerCase() yet the regex is already case-agnostic.
If you're going to attempt email address validation, either go all out[1], or just use isValidEmail=(e)=>~e.indexOf("@")