Slice String JavaScript, если есть @
let email = 'john@example.com'
let localPart = email.slice(0,email.indexOf('@'));
Witty Weevil
let email = 'john@example.com'
let localPart = email.slice(0,email.indexOf('@'));