How to extract the domain name from an email address in TypeScript

1 Answer

0 votes
const email = 'username@emailonline.com';

const domain = email.substring(email.lastIndexOf("@") + 1);

console.log(domain); 

  
  
  
  
/*
run:

"emailonline.com" 
  
*/

 



answered Apr 29, 2022 by avibootz

Related questions

1 answer 182 views
1 answer 143 views
1 answer 177 views
1 answer 189 views
1 answer 173 views
1 answer 203 views
...