JavaScript substring
The output of above function is plusNote that one blank space is included in the above output at the left side. Getting domain part of email addressWe will use indexOf to get the location of the string inside another string, using this we can find out location of '@' and dot '.' within an email address. Then using these two locations we will collect domain part by using substr function.Here is the code.
The output is
If the variable end is omitted, then rest of the string is considered.
Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
![]() | ||||||
| ||||||