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 172 views
1 answer 131 views
1 answer 166 views
1 answer 179 views
1 answer 159 views
1 answer 196 views
...