I have 6 email address like below:
(1) ali@hotmail.com -> valid
(2) @hotmail.com -> invalid
(3) ali@hotmail.com, abu@hotmail.com -> valid
(4) ali@hotmail.com, @hotmail.com -> invalid
(5) ali@hotmail.com, abu@hotmail.com, ahmad@hotmail.com -> valid
(6) ali@hotmail.com, @hotmail.com, ahmad@hotmail.com -> invalid
How do I use JavaScript to determine that the email address is in full format?
I try startsWith("@hotmail.com")
, endsWith("hotmail.com")
, indexOf("@hotmail.com")
also cannot fulfill all the email addresses above.
Can someone help me?