Slice String JavaScript si tiene @

let email = '[email protected]'
let localPart = email.slice(0,email.indexOf('@'));
Witty Weevil